1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Default context to {}

This commit is contained in:
Les Hill 2011-09-05 16:30:44 -07:00
parent 62d80310f4
commit ce142afac4

View file

@ -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