Saturday, May 14, 2011

calling partial in layouts Rails 3.1

in "app/views/layouts" folder should only contain layouts( application , controllers1 , controllers2 , controllers3 , ...)

No more '_partials' inside 'app/views/layouts' folder
lets the '_partials' files can go into corresponding "app/views/#{layout_name}/" folder

you can use the partials from anywhere inside your views
rails will automatically detect corresponding partial files
first preference is for the current_layout in"app/views/#{layout_name}/" folder
next preference is "app/views/application/" folder

Nested Layouts

#controller_names.html.erb
<% content_for :content do %>
something is here
<% end %>
<%= render :template => 'layouts/application' %>


#application.html.erb
<%= content_for?(:content) ? yield(:content) : yield %>

there is a lot of nice futures in rails 3.1
few of those are Sprockets on (Sass + Coffescript) is very nice for development , Streaming , etc