One thing that always annoyed me when rendering collection partials is that a local var in partial is named same as a partial template name. So, to go around this I always created another local variable in partial and gave it a more meaningful name.

No longer… As the Ryan says from now on in the Edge Rails you can specify the name of the local variable in which each collection element will be exposed within a partial. You will can do this:

render :partial => 'employees', :collection => @workers, :as => :person

It’s a simple thing, but it’s just one of the things that bugged me. I am glad it’s gone now.

Tags: edge, rails

Comments

comments powered by Disqus