我对Rails 3和Devise有一个特殊的问题.我的Rails应用程序有3种用户类型:
客户端,所有者和管理员
routes.rb中:
devise_for :admins
devise_for :owners
devise_for :clients
Run Code Online (Sandbox Code Playgroud)
application_controller.rb:
def after_sign_in_path_for(resource)
if resource == "client"
"/client_accounts/" + current_client.id.to_s
elsif resource == "admin"
stored_location_for(:admins) || "/admin/control_panel"
elsif resource == "owner"
stored_location_for(:owners) || "/client_accounts"
end
end
Run Code Online (Sandbox Code Playgroud)
我的登录所有者和管理员工作正常,但我无法让客户登录工作..这是我得到的错误:
NoMethodError in Devise/sessionsController#create
undefined method `client_url' for #<Devise::SessionsController:0x10a98f868>
Run Code Online (Sandbox Code Playgroud)
应用程序跟踪为空.