2012-07-10 4 views
0

나는 블로그 응용 프로그램을 만드는 데 Enki gem을 사용하고 있습니다. 기본적으로는 나는 homes_controller.rb있는 발판을 만들어, 나는 블로그 루트 페이지 싶지 않아,레일 루트 루트 변경

root :to => 'posts#index' 

그러나 posts_controller.rb의 인덱스 루트 경로를 만드는, 그래서 그 변화를 만들기에도 불구하고,

root :to => 'homes#index' 

그러나 루트로 설정하려고, 여전히 내가 서버를 시작할 때 # 인덱스를 게시하는 해결합니다. 새 브라우저에서 사용해도 (즉, 캐싱 문제가 아닙니다.) 똑같습니다.

아래 config/routes.rb 파일을 복사했습니다. 아무도 설명 할 수 있습니까 ...

Enki::Application.routes.draw do 


    namespace :admin do 
    resource :session 

    resources :posts, :pages do 
     post 'preview', :on => :collection 
    end 
    resources :comments 
    resources :undo_items do 
     post 'undo', :on => :member 
    end 

    match 'health(/:action)' => 'health', :action => 'index', :as => :health 

    root :to => 'dashboard#show' 
    end 

    resources :archives, :only => [:index] 
    resources :pages, :only => [:show] 
resources :homes 
    constraints :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ do 
    get ':year/:month/:day/:slug/comments' => 'comments#index' 
    post ':year/:month/:day/:slug/comments' => 'comments#create' 
    get ':year/:month/:day/:slug/comments/new' => 'comments#new' 
    get ':year/:month/:day/:slug' => 'posts#show' 
    end 

    scope :to => 'posts#index' do 
    get 'posts.:format', :as => :formatted_posts 
    get '(:tag)', :as => :posts 
    end 

    #root :to => 'posts#index' 
    root :to => 'homes#index' 

end 
+2

위로 가기 루트를 파일의 맨 위로 이동하십시오. – Dty

답변

0

루트 파일 위에 루트를 넣으십시오. Rails 라우팅이 위에서 내려 가기