I'm using rails 3.0.9, cancan 1.6.7 and devise 1.4.8
I'm using two devise models(User and Admin) for different log-in and registration process
So I want to divide the abilities depend upon the logged-in user(resource), because there are more than 70 models and only 10 models are common for both type of users(here more than 50 models and views are only used by Admin users)
I want to implement two Ability class(UserAbility and AdminAbility) and the devise helper method current_user/current_admin should be passed to UserAbility/AdminAbility
Example:
In ApplicationController.rb file
def current_ability
if current_user
@current_ability = UserAbility.new(current_user)
elsif current_admin
@current_ability = AdminAbility.new(current_admin)
end
end
From the above my questions,
Is multiple ability class is possible in cancan, if possible then how to create it because I tried
rails g cancan:user_ability
but I got error as Could not find generator cancan:user_ability.
How to choose the appropriate Ability class for the logged-in User/Admin.
If a controller is accessed by both the User and Admin, then how can I get the currently logged-in User/Admin's object
Is there any other solution for this?
Any one please help to solve this