Sure thing:

class Portal < ActiveRecord::Base
  has_many :programs
  has_many :users, :through => :programs
end

class Program < ActiveRecord::Base
  belongs_to :portal
  has_many :program_memberships, :dependent => :destroy
  has_many :users, :through => :program_memberships
end

class ProgramMembership < ActiveRecord::Base
  belongs_to :user
  belongs_to :program
end

class User < ActiveRecord::Base
  has_many :program_memberships, :dependent => :destroy
  has_many :programs, :through => :program_memberships
  has_many :portals, :through => :programs
end


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to