How to use Devise with 2 models in Rails?
I have the model User and Seller. I want to replace my authentication system with Devise but I'm not sure how devise handles having 2 differen开发者_开发问答t models.
How can I know when signed_in? is for Users or Sellers? And all the other methods like that.
Thanks.
You can use as many models as you want with devise. In your example, you'd have a current_user and current_seller in your controllers that would give you the relevant accounts. The signed_in? method common to other frameworks is user_signed_in? for devise (and you'd have a seller_signed_in? as well).
精彩评论