This project is archived and is in readonly mode.
ActionView#assigns lost its usefulness
Reported by Mislav | November 9th, 2009 @ 12:08 AM | in 3.0.2
In Rails 2.3.4 I was able to do something in the lines of:
@view = ActionView::Base.new
# later:
@view.assigns[:foo] = 'bar'
# finally:
@view.render(:inline => @template, :locals => locals)
That is, update the assigns list after instantiation and have it affect the rendering.
In Rails 3, the assigns hash is copied to local instance
variables
immediately in the initializer. This hash is copied to
@assigns
and exposed through an #assigns
accessor like before, but this object is never used internally
again and thus writing to it has no effect. The only way to pass
assigns now is during the initialization:
@view = ActionView::Base.new([], @assigns)
This seems like a regression because the old way was certainly useful.
Comments and changes to this ticket
-
Jeremy Kemper November 9th, 2009 @ 05:16 AM
- Milestone cleared.
- Assigned user set to Yehuda Katz (wycats)
-
Yehuda Katz (wycats) February 24th, 2010 @ 07:46 AM
- State changed from new to wontfix
This was modified in order to improve performance and reduce the number of instance variable assigns we need to do in cases with many renders inside a single view.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>