I have a user model and a dealer and customer model, which inherit the user class and have no own database table:
class User < ActiveRecord::Base
end
class Dealer < User
before_save :set_default_values
def set_default_values
self.role_id = Role.find_by_handle('dealer').id
end
end
class Customer < User
…
end
I don´t use scopes because i want something like a dealer_path and some custom logic per role.
Now i´m wondering how to tell my dealer/customer model that it´s role-dependent, so that i can use (for example) Customer.all and just get users with the role 'customer'.
Can someone point me in the right direction?