devise - Rails 3 devise_for and STI -
i have following models:
user athlete < user coach < user
in routes, have following:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations" }
i wanting create route each sign_up
path (ie: /sign_up/coach, /sign_up/athlete)... should create 2 different registration controllers or there way 1 registration controller?
you can use single registration controller doing this:
class userscontroller < devise::registrationscontroller private def resource_class params[:type].present? ? params[:type].classify.constantize : super end end
there other tweeks need do. whether worth or not, guess depends on how similar models are.
hope helps!
Comments
Post a Comment