Reserved 'index' method/variable bug in partials
Reported by oladywek (at gmail) | April 2nd, 2008 @ 11:08 AM | in 0.9.8
I have the following code structure:
http://pastie.caboo.se/private/r...
<%= index %> in _property.html.erb calls 'index' method from ContactsController.
The problem was solved renaming 'index' to 'i' in the partial.
Might be a bug.
Comments and changes to this ticket
-
Michael Klishin (antares) May 11th, 2008 @ 03:11 PM
- → Milestone changed from to 0.9.4
-
Michael D. Ivey (ivey) June 12th, 2008 @ 01:07 AM
It's not that index is reserved, it's that you've already given index a meaning.
Views evaluate in controller context. That's just something you have to be aware of when naming local variables.
-
Michael Klishin (antares) August 2nd, 2008 @ 06:45 PM
- → Tag changed from to documentation merb merb-core partial template
- → Milestone changed from 0.9.4 to 0.9.8
- → State changed from new to open
-
Nikos Dimitrakopoulos September 23rd, 2008 @ 01:01 AM
- → Tag changed from documentation merb merb-core partial template to documentation merb merb-core partial template
Hopefully this will help in closing one of the remaining tickets for 0.9.8. :)
Added documentation about this local variables' naming issue as a note, both in #render and #partial.
-
Michael Klishin (antares) September 23rd, 2008 @ 05:56 AM
I think we need to solve this problem at a different scale. Not by introducing ad hoc checks and documentation notes, but by completely moving partial locals implementation away from method_missing.
-
Michael Klishin (antares) September 23rd, 2008 @ 05:56 AM
That does mean I'd reject this patch, it does not solve the problem and tries to cover it instead.
-
Michael Klishin (antares) October 5th, 2008 @ 12:42 PM
- → State changed from open to invalid
Closing this one, this is actually a duplicate of long standing #42 and should be addressed at a higher level than just updating docs.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
