This project is archived and is in readonly mode.
Naming a partial _when.html.erb throws a compile error
-
Hugo Peixoto
When you create a partial such as
_house.html.erb, it automatically passes the variable@houseto a local variable namedhouse. So, would you create a partial named_when.html.erband you wouldn't be able to access the local variable namedwhen. This, of course, isn't possible as 'when' is a reserved keyword.So to allow for the creation of "reserved keyword partials", this variable passing feature would have to be removed. I don't really see this as an option, so I'd rather add a note to the documentation stating this.
-
Zach Hale
A reasonable conclusion. It just really threw me for a loop. Maybe an error if a reserved word is used and called as a partial?
-
Ryan Bigg
- State changed from new to open
- Importance changed from to Low
I don't think this will be fixed. Catching the odd case where people name a partial that uses a reserved word will slow down partial rendering.
-
David Trasbo
- State changed from open to wontfix
I'm with Ryan on this. Marking this
wontfixfor now. If anyone can propose a solution that doesn't slow down this performance critical part of Rails (and prove it with benchmarks, etc.) I'll be happy to re-open.