2017-02-16 2 views
0

新しいレールアプリで問題を設定しています。私は新鮮なRailsアプリケーションを作成し、devise gemを追加してbundle installを実行しました。今、私はrails generate devise:installを実行しようとすると、私はこのエラーを取得:私はrake:routesを実行したときにセットアップのエラーを作成する

/Users/Bobo/.rvm/gems/ruby-2.2.4/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:557:in `add_route': Invalid route name, already in use: 'new_user_session' 
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. 

私は混乱している、私も私のルートは、まだファイル触れていないしていることは言う:You don't have any routes defined!

なぜ私はこのエラーが発生していますか?それは文字通り私が取った最初のステップです。..

編集:私のルートはあなたがどんなルートが定義されていない

Rails.application.routes.draw do 
    # The priority is based upon order of creation: first created -> highest priority. 
    # See how all your routes lay out with "rake routes". 

    # You can have the root of your site routed with "root" 
    # root 'welcome#index' 

    # Example of regular route: 
    # get 'products/:id' => 'catalog#view' 

    # Example of named route that can be invoked with purchase_url(id: product.id) 
    # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 

    # Example resource route (maps HTTP verbs to controller actions automatically): 
    # resources :products 

    # Example resource route with options: 
    # resources :products do 
    #  member do 
    #  get 'short' 
    #  post 'toggle' 
    #  end 
    # 
    #  collection do 
    #  get 'sold' 
    #  end 
    # end 

    # Example resource route with sub-resources: 
    # resources :products do 
    #  resources :comments, :sales 
    #  resource :seller 
    # end 

    # Example resource route with more complex sub-resources: 
    # resources :products do 
    #  resources :comments 
    #  resources :sales do 
    #  get 'recent', on: :collection 
    #  end 
    # end 

    # Example resource route with concerns: 
    # concern :toggleable do 
    #  post 'toggle' 
    # end 
    # resources :posts, concerns: :toggleable 
    # resources :photos, concerns: :toggleable 

    # Example resource route within a namespace: 
    # namespace :admin do 
    #  # Directs /admin/products/* to Admin::ProductsController 
    #  # (app/controllers/admin/products_controller.rb) 
    #  resources :products 
    # end 
end 
+2

あなたの 'routes.rb'はどのように見えますか? – Iceman

+0

投稿に追加 – stoerebink

+1

新しいレールアプリを作成した直後に 'devise'を追加しましたか、どこに変更しましたか? – Iceman

答えて

0

ファイル、彼らはすべてコメントアウトされています。例:ルートルートのコメントを外します。変更

# root 'welcome#index' 

    root 'welcome#index' 
+0

これは 'devise'が動作しない理由ではありません – Iceman

-1

ルートを変更してください。上述したようにルート は必ずと呼ばれるコントローラを持っていることを確認し設定したテンプレートとアクションをようこそ「インデックス」 次にルート=>歓迎#インデックスは、そのアクションを指します。

実行

rails generate devise:install 

実行

これは自動的に作成しているよりもOR rails5 rails db:migrate でroutes.rbをファイル

実行rake db:migrateにあなたのモデルのためのルートを追加します

rails g devise Model 

モデルをDeviseで作成する。

0

新しいディレクトリに新しくインストールしましたが、これ以上問題はありません。

関連する問題