0
我正在使用Ruby on Rails 3.2.9。在我的应用程序中,我想处理登录并注销多个“事物”的功能,因为除了经典用户,“其他事物”可以登录和注销。我想实现一个“专用” REST-FUL对于可以进行身份验证,也许是使类似的config/routes.rb
文件中的下列各事sessions_controller
:如何处理多个“事物”的登录和注销功能?
# Before:
# resources :users
# resources :other_things
# After:
resources :users do
resource :sessions, :only => [:new, :create, :destroy], :controller => 'users/sessions'
end
resources :other_things do
resource :sessions, :only => [:new, :create, :destroy], :controller => 'other_things/sessions'
end
与上面的代码我想“独立” /用户和其他事物的“名称空间”身份验证问题。然而,与上面的代码做,我想在比赛上的符号和登出的网址如下所示:
localhost/users/sign_in
localhost/users/sign_out
localhost/other_things/sign_in
localhost/other_things/sign_out
如何应该我继续吗?你有什么建议?
您确定这些信息未能转换为用户?也许不同类型的用户? – MurifoX
@MurifoX - 是的,我是。 “事物”(用户和其他事物)旨在以不同方式使用并具有不同的会话。 – user12882