네임 스페이스 루트를 정의레일 경로 : 나는이 컨트롤러를 가지고
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
잘하고 있습니다.'controllers/mobile/posts_controller.rb' 클래스가 class Mobile :: PostsController
jan267