Hi,
i have 3 models
users, companies and roles
User belongs_to role User has and belong to many companies Role has_one User
Thru this association i can do something like:
User.companies <-- i get all companies that a user has
User.role <-- i get the role that a user belongs_to
I was thinking now, when a user has role_id == 0 (admin) the companies should return all companies (Company.all). To do it i was thinking to overwrite the companies method and if a user has role_id == 0, i return Company.all otherwise i call super. Is that correct? if yes, how should i implement this code? Directly in my User Model? Should i just extend Array?