Rails Helpers and Instance Variables
November 10th, 2005
I was reading the code for the FileColumn, helper and I had a thought. What if we could obviate the need for requiring instance variables for helpers ?
A recent example on the mailing list ? render partial and passing in the object, by Mark Van Holstyn. In the thread, he asks why he can’t do:
His partial being: Reading FileColumn helper’s code, and the code in Rails own helpers, the following idiom is used to get a hold of the instance variable:What if we did it this way instead ?
Actually, this should all be abstracted away in some kind of helper for helpers. Let me take a moment to prepare a patch. I think this would make things quite a bit easier for partial users.
Leave a Reply