Layouts and rendering: errors in section on rendering partials?


It seems to me the section on rendering partials in the 'Layouts and
Rendering' guide is very confusing.

    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?

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.

But need to remember that if you want to send some variables like :locals you still need to use the :partial option.


    <%= render :partial => 'foo', :locals => {:a => 1} %>


    <%= render 'foo', :a => 1 %>

Thanks Xavier, nice to know :slight_smile:


       <%= render :partial => 'foo', :locals => {:a => 1, :b => 2 } %>


       <%= render 'foo', {:a => 1, :b => 2 } %>