Design a separate lunge for two different models

I have two User and Admin models (with RailsAdmin) that use Devise. I log in as a user and then as an administrator. But the result of extracting from one of these models is the simultaneous shutdown of two models. How can i fix this? Please, help:)

+8
authentication ruby-on-rails devise rails-admin
source share
2 answers

The problem was on one line in config / initializers / devise.rb:

  • Default:

    # Configure sign_out behavior.
    # Sign_out can be limited (i.e. / Users / sign_out only affects the user's area).
    # The default value is true, which means that any logout action will display all active areas.
    # config.sign_out_all_scopes = true

  • Necessary:

    config.sign_out_all_scopes = false

+23
source share

The scope of development is the whole application - you enter the site, not the model. Perhaps you want to add a role distinction - a user may have one or more roles that allow them certain privileges. The developer just gets you an authenticated user. Consider a gem such as CanCan , which provides support for "role-based authorization."

0
source share

All Articles