Class: ActionView::Partials::PartialRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/template_wrapper/mixins/rails3.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/template_wrapper/mixins/rails3.rb', line 27

def render
    #puts "PartialRenderer.render OVERRRIDE"
  identifier = ((@template = find_template) ? @template.identifier : @path)
  if @collection
    ActiveSupport::Notifications.instrument("render_collection.action_view",
      :identifier => identifier || "collection", :count => @collection.size) do
     content =  render_collection
    end
  else
    block, options, locals = @block, @options, @locals

    content = ActiveSupport::Notifications.instrument("render_partial.action_view",
      :identifier => identifier) do
      content = render_partial
    end

    if !block && (layout = options[:layout])
      content = @view._render_layout(find_template(layout), locals){ content }
    end

   TemplateWrapper::wrap(@template.inspect, content) 
  end
end

#render_partial(object = @object) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/template_wrapper/mixins/rails3.rb', line 52

def render_partial(object = @object)
#puts "PartialRenderer.render_partial OVERRRIDE"
   
    locals, view, template, block = @locals, @view, @template, @block
    #puts "  #{template.inspect}"
    object ||= locals[template.variable_name]
    locals[@options[:as] || template.variable_name] = object
      the_return = template.render(view, locals) do |*name|
      view._layout_for(*name, &block)
    end 
    the_return
end