Displaying 1 result from an estimated 1 matches for "groupabale".
2006 Aug 16
0
Polymorphic Associations and grouping users and projects
...project groupings to the admin and I
think I may need to use polymorpic associations. However I dont know if
this is he best option.
For someone who is much brighter than me, is the code below the best way
to achieve this?
class User < ActiveRecord::Base
has_many :memberships, :as => :groupabale
has_many :groups, :through => :memberships
end
class Project < ActiveRecord::Base
has_many :memberships, :as => :groupable
has_many :groups, :through => :memberships
end
class Membership < ActiveRecord::Base
belongs_to :group
belongs_to :groupable, :poymorphic =...