0
我已经定制了registrations_controller.rb
和confirmations_controller
的devise
。这些控制器位于custom_devise文件夹下。有时会获得未初始化的常量Devise :: CustomDevise
有时我的注册和确认工作正常,但有时它显示uninitialized constant Devise::CustomDevise
路由错误。
而一个奇怪的修复方法是每当我编辑routes.rb
错误消失(没有实际添加任何东西在routes.rb
)。
我routes.rb
的设计:
devise_scope :user do
scope :module => "custom_devise" do
match 'company_user/complete_profile' => 'confirmations#complete_profile', via: :get
end
end
devise_for :users, path_names: {sign_in: "login", sign_out: "logout"},
:controllers => { :registrations => "devise/custom_devise/registrations",
:confirmations => "devise/custom_devise/confirmations"
}
我使用下面的设计模块:
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
P.S:我周围的所有类似的答案在SO检查,但没有为妄作。因此,请在发表此问题之前重复评论。:)