开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜