If I declare local variables in a partial and then render the partial from another erb template, will the latter also have accces to those local variables?
views:
125answers:
2
+1
A:
Short answer: Yes. You would theoretically be able to access the defined variable.
Longer answer: Don't define variables in views. Adding logic to the views (and therefore pushing it to the client) is really bad practice. Use models for your business logic and controllers for your action handling.
Bryan Woods
2009-07-14 21:34:44
+2
A:
I agree with Bryan's advice although I would also refer you to this answer which is a little bit more comprehensive on the same subject of where to define view-related variables.
flo
2009-07-14 22:11:25