我有2个控制器:
app/
/controllers
posts_controllers.rb
/mobile
posts_controllers.rb
我的routes.rb看起来是这样的:
root :to => "posts#index"
resources :posts
namespace :mobile do
root :to => "posts#index"
resources :posts
end
但是,当我访问/mobile
,它反正渲染第一个控制器的索引页,也试过这样:
namespace :mobile do
root :to => "mobile/posts#index"
resources :posts
end
但它给我的错误: uninitialized constant Mobile::Mobile
我想渲染第二控制器的索引页,我该怎么办呢?
编辑
通过输入/移动我想渲染设在这里的文件:
app/
views/
/mobile
/posts
index.html.erb
但它在这里撕心裂肺的文件:
app/
views/
/posts
index.html.erb