I think you do not need to create different models, because you do not have specific fields for each. Therefore, you just need to set the "role" of each user. Two options: create a role table or add a field role to the user field. Both solutions work, the second - more flexible, but less optimized.
But in your particular case, you do not have complex role management so that you can find a simpler solution. If all your users are artists, you do not need to indicate this in your code, it is contained in an implicit description of what the user is. Therefore, you just need to save if the user is an administrator or not, and I believe that the best solution is to create the is_admin boolean field.
After that, you will need to create some before_filter in your protected controllers, for example:
before_filter => :authorize, :only => :new, :edit, :create, :update, :destroy def authorize redirect_to :root if not current_user.is_admin? end
And you may have simple queries:
@artists = User.all @moderators = User.where(:is_admin => true)
If you are looking for a more complete authorization system, you can check out this little gem: https://github.com/ryanb/cancan
But I think this is not the case at the moment. If you have a simple problem, try a simple solution!
source share