Navigation Menu

Skip to content

Commit

Permalink
Make partial! consistent with render signature
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Mar 29, 2012
1 parent d8398f2 commit e2a6616
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/jbuilder_template.rb
Expand Up @@ -7,11 +7,18 @@ def initialize(context)
@context = context
super()
end

def partial!(partial_name, options = {})
@context.render(partial_name, options.merge(:json => self))

def partial!(options, locals = {})
case options
when Hash
options[:locals] ||= {}
options[:locals].merge!(:json => self)
@context.render(options)
else
@context.render(options, locals.merge(:json => self))
end
end

private
def _new_instance
__class__.new(@context)
Expand Down

0 comments on commit e2a6616

Please sign in to comment.