My user model is as follows:
User habtm :Roles Role habtm :Users RoleExtension belongs_to :Role
mysql tables:
users id .. roles id .. roles_users user_id role_id role_extensions id role_id feature_id .. ..
Now everything is working fine.
Now I want the User model to have a RoleExtensions set based on the habtm Roles collection.
Example:
user = User.find(1) user.Roles (returns roles with id of 1,2,3)
So I want:
user.RoleExtensions
to return all role extensions that have role_id in (1,2,3)
ruby-on-rails
Blankman
source share