设计安装错误

问题描述:

我在设置新版Rails应用程序时遇到了问题。我刚刚创建了一个新的Rails应用程序,添加了设计宝石并运行了bundle install。现在,当我尝试运行rails generate devise:install我得到这个错误:设计安装错误

/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. 

我很困惑,我还没有碰到我的路线文件呢,当我运行rake:routes它说: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

在创建新的rails应用程序之后您是否添加了'devise',或者您是否在任何地方更改了任何内容? – Iceman

您没有任何路线定义,它们都被注释掉了。取消注释根路由,例如更改

# root 'welcome#index' 

    root 'welcome#index' 
+0

这不是为什么“设计”不起作用 – Iceman

更改您的路线。如上所述设置 确保您有一个名为控制器欢迎光临用模板和行动“索引” 然后用root =>欢迎#指数将指向作用。

运行

rails generate devise:install 

运行

rails g devise Model 

这将自动为您示范路由添加到的routes.rb文件

运行rake db:migrate或与rails5 rails db:migrate 比你有创建模型与设计。

我做了一个新的安装在一个新的目录,没有更多的问题。