-1
Im stack with this devise routes error。这个问题只在我的生产 服务器,但在我本地没有问题。路由问题设计
我使用Phusion Passenger Apache。为我的生产设置。错误是。
uninitialized constant User::RegistrationsController
我的routes.rb占优控制器
devise_for :users, :controllers => { registrations: 'user/registrations'}
Path是
app/controllers/User/registrations_controller.rb
应用程序/控制器/用户/ registrations_controller.rb
class User::RegistrationsController < Devise::RegistrationsController
before_filter :authenticate_person!, :redirect_unless_admin
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
set_flash_message! :notice, :signed_up
#sign_up(resource_name, resource)
#respond_with resource, location:
after_sign_up_path_for(resource)
redirect_to new_user_registration_path
else
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
expire_data_after_sign_in!
# respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
end
end
private
def redirect_unless_admin
unless current_person.is_a?(Admin)
redirect_to root_path
end
end
def sign_up_params
params.require(:user).permit(:username,:email, :password, :password_confirmation,:company, :branch, :branch_id)
end
def account_update_params
params.require(:user).permit(:username, :branch, :company, :email, :password, :password_confirmation, :current_password)
end
end
迫切需要帮助的感谢。
你能请告诉你的注册控制器?除非另有说明,路径总是较低的,但我不认为这是造成问题的原因 – Mark
@Mark我添加了registrations_controller.rb – coolshox
路径必须是小写,'user'而不是'User' – Iceman