How to render a partial from another namespace in Rails 3?
In my Rails 3 project I have:
namespace :admin d开发者_如何学JAVAo
resources :users
end
scope :frontend do
resources :users
end
There is a partial with filename "/views/admin/users/_form_fields.html.haml".
And I want to render it from "/views/frontend/users/_form.html.haml".
This code doesn't work:
render 'admin/users/form_fields', :f => f
To pass local variables you need this sintax:
render :partial => "/admin/users/form_fields", :locals => { :f => f }
Hope this helps. you can take a look to Rails Guide: Using Partials
精彩评论