On Oct 4, 2012, at 12:43 PM, Dean wrote:
> I've done a bit of tracing on this and tracked the problem down the following
> code in dryml/template_handler.rb
>
> class ActionView::Template
>
> def render_with_dryml(view, local_assigns = {})
> if handler == Dryml::TemplateHandler
> render_dryml(view, local_assigns)
> else
> render_without_dryml(view, local_assigns)
> end
> end
> alias_method_chain :render, :dryml
>
> The weird thing is that handler == Dryml::TemplateHandler evaluates as true
> on the first render, but evaluates to false on all subsequent renders - even
> though, according to the debugger, the handler method returns
> Dryml::TemplateHandler each time.
>
I've hit this sort of thing a lot in development mode - the problem is that
something is reloading the Dryml module. The net result is that objects left
behind from *before* the reload look like they're the right class, but they
actually point to a different object (thus failing the comparison). A quick
example in the console:
Loading development environment (Rails 3.2.8)
[1] pry(main)> User.object_id
=> 2151798380
[2] pry(main)> reload!
Reloading...
=> true
[3] pry(main)> User.object_id
=> 2173205700
[4] pry(main)> ActiveRecord::Base.object_id
=> 2181548000
[5] pry(main)> reload!
Reloading...
=> true
[6] pry(main)> ActiveRecord::Base.object_id
=> 2181548000
[7] pry(main)>
(replace 'User' with any model, or really any class reloaded by reload!)
Note that ActiveRecord::Base doesn't change it's object_id, but the model does.
No idea how to fix this, but it at least makes sense *why* it's happening now.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.