Rudrakshi
Rudrakshi

Reputation: 25

how does devise works with multiple models?

My project uses the feature of devise for User model as well as Active Admin. I want to implement independent devise behavior for both User and Active Admin. Please suggest suitable answer.

Thanks in advance.

Upvotes: 1

Views: 125

Answers (2)

Shivam Bajpai
Shivam Bajpai

Reputation: 1260

As you have implemented devise for more than one resource then you may redirect it to different location by identifying the resource like this

def after_sign_in_path_for(resource)
  case resource
    when User then {redirect_path}
    when Admin then {redirect_path}
  end
end

Upvotes: 2

abhsss96
abhsss96

Reputation: 353

You can't change this because active admin also uses devise so when you change the functionality of user from devise then it will reflect in active admin as you make changes in devise.rb which by default used for active admin also uses .SO how can you think for two different response from same configuration file.

Upvotes: 0

Related Questions