Displaying 1 result from an estimated 1 matches for "roleabl".
Did you mean:
roleable
2006 Aug 16
1
Naming rights_roles join model using has_many :through and polymorphic associations
...things as
well such as groups of users. What I don''t want is to have to create
another join table roles_groups.
I think this can be re-factored using polymorphic associations like so.
NEW MODEL CLASSES:
class User < ActiveRecord::Base
has_many :responsibilities, :as => :roleable
has_many :roles, :through => : responsibilities
end
class Group < ActiveRecord::Base
has_many :responsibilities, :as => :roleable
has_many :roles, :through => : responsibilities
end
class Responsibilities < ActiveRecord::Base
belongs_to :group
belongs_to :user
end...