设计的未定义方法`registrationsController':模块

时间:2015-03-06 20:18:56

标签: ruby-on-rails-4 devise

导航到我的登录/注册页面时出现以下错误:

未定义的方法`registrationsController' for Devise:Module

/users/registrations_controller.rb

class Users::RegistrationsController < Devise::registrationsController
   # def new
   #   super
   # end

   # def create
   #   super
   # end
end

/config/routes.rb

Rails.application.routes.draw do

   get 'spotkeys/spot_page'

   root 'spotkeys#index'

   get 'index'         => 'spotkeys#index'
   get 'dashboard'     => 'spotkeys#dashboard'
   post 'dashboard'    => 'spotkeys#dashboard'
   get 'settings'      => 'spotkeys#settings'
   get 'key_settings'  => 'spotkeys#key_settings'
   get 'qr_codes/new'
   get 'qr_codes/create'

   get 'settings'      => 'spotkeys#settings'
   get 'key_settings'  => 'spotkeys#key_settings'

   match 'dashboard' => 'spotkeys#dashboard', as: :new_spotkey, via: [:get, :post]

   get 'signup',      to: 'users/registrations#new', :as => :new_user_session
   post 'signin',     to: 'users/sessions#create',  :as => :user_session
   delete 'signout',  to: 'users/sessions#destroy'

   resources :qr_codes, only: [:new, :create]
   resources :spotkeys
   resources :keys

   devise_for :users,

              :controllers => { :registrations => 'users/registrations',
                           :confirmations => 'users/confirmations',
                           :sessions => 'users/sessions',
                           :omniauth_callbacks => 'omniauth_callbacks'
                          },

          :to => 'users/sessions#destroy', :as => :destroy_user_session,

          :skip => [:sessions] do
  end
end

我正在使用:

rails 4.2.0

ruby​​ 2.1.5p273

1 个答案:

答案 0 :(得分:0)

您的继承定义错误。您错误地输入了小写r而不是父类中的大写R。你应该像这样定义你的控制器:

class Users::RegistrationsController < Devise::RegistrationsController