Can 'locals' be used with 'collection' when rendering partials in Rails?
Posted
by Gav
on Stack Overflow
See other posts from Stack Overflow
or by Gav
Published on 2010-06-01T09:31:34Z
Indexed on
2010/06/01
9:33 UTC
Read the original article
Hit count: 281
ruby-on-rails
Everything works okay when I try to render a partial like this:
= render :partial => "/shared/enquiry/car_type", :collection => @enquiry.available_car_types
However, if I also want to pass a variable (in this case 'path', because I'm sharing this partial across two forms), the path is not available to me:
= render :partial => "/shared/enquiry/car_type", :collection => @enquiry.available_car_types, :locals => {:path => customers_enquiry_path}
I've tried moving things around, but nothing appears to work, leading me to believe one cannot use locals with collections. Any help would be appreciated.
Gav
© Stack Overflow or respective owner