Ivo
(Ivo)
November 9, 2010, 8:59am
1
Hi,
It seems to me the section on rendering partials in the 'Layouts and
Rendering' guide is very confusing.
says:
To render a partial as part of a view, you use the render method
within the view, and include the :partial option:
followed by a number of examples, *none* of which include a :partial
option. Am I missing something here or is this
really a rather large error?
fxn
(Xavier Noria)
November 9, 2010, 9:10am
2
The :partial option is no longer needed, and calls without :partial
are preferred.
That needs a revision though, it should first present an example using
:partial, then say that it can be obviated, present the same example
without :partial, and say it won't be used in the rest of the section
or whatever.
Wilker
(Wilker)
November 9, 2010, 12:07pm
3
But need to remember that if you want to send some variables like :locals you still need to use the :partial option.
fxn
(Xavier Noria)
November 9, 2010, 8:04pm
4
Well,
<%= render :partial => 'foo', :locals => {:a => 1} %>
becomes
<%= render 'foo', :a => 1 %>
Wilker
(Wilker)
November 9, 2010, 9:19pm
5
Thanks Xavier, nice to know
Dev_Guy
(Dev Guy)
November 14, 2010, 1:03am
6
Likewise
<%= render :partial => 'foo', :locals => {:a => 1, :b => 2 } %>
becomes
<%= render 'foo', {:a => 1, :b => 2 } %>