mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Merge pull request #27 from leshill/default_context
Default context to {}
This commit is contained in:
commit
a1d16cbfa7
1 changed files with 3 additions and 2 deletions
|
@ -14,8 +14,9 @@ module Draper
|
|||
#
|
||||
# @param [Object] instance to wrap
|
||||
# @param [Object] context (optional)
|
||||
def initialize(input, context = nil)
|
||||
def initialize(input, context = {})
|
||||
input.inspect # forces evaluation of a lazy query from AR
|
||||
input.inspect
|
||||
self.class.model_class = input.class if model_class.nil?
|
||||
@model = input
|
||||
self.context = context
|
||||
|
@ -87,7 +88,7 @@ module Draper
|
|||
#
|
||||
# @param [Object] instance(s) to wrap
|
||||
# @param [Object] context (optional)
|
||||
def self.decorate(input, context = nil)
|
||||
def self.decorate(input, context = {})
|
||||
input.respond_to?(:each) ? input.map{|i| new(i, context)} : new(input, context)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue