This project is archived and is in readonly mode.
Layout option for partial collections specifies an overall layout rather than a partial layout
-
Mark Reginald James
The duplication is fixed in the current master, but render always looks for and treats the provided layout as a layout for the entire collection.
I think being able to use a partial layout when rendering collections is more valuable than an overall layout.
There are four alternatives:
- Leave as is.
- Make the layout option work as a partial layout instead.
- Allow automatic switching between the two modes depending on whether the target layout file starts with an underscore.
- Add a new
:partial_layoutoption to render.
Which is preferred?
-
Mark Reginald James
- Title changed from Layout option does not work when rendering partial collections to Layout option for partial collections specifies an overall layout rather than a partial layout
-
Pratik
- Assigned user set to Pratik
- State changed from new to wontfix
You should just use the layout inside the partial :
# _brackets.html.erb [<%= yield %>] # _item.html.erb <% render(:layout => 'bracket) do %> <%= item %> <% end %> # collection.html.erb <%= render :partial => 'item', :collection => %w(a b) %> -
Martin Schubert
Even the ticket is allready a year old i keep to stumble into the same situation:
needing different layouts for each item when a collection is rendered.
the solution from "Pratik" doesn
t solve this problem.or is there another workaround i am not aware of?