Permalink
Browse files

project-has-many-members

Let's do the other ends of those two belongs-to associations. In the Project model:

SHOW_PATCH
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent 73ec433 commit 2286479266c6272b12f6935642937a21ab5618b2
Showing with 4 additions and 0 deletions.
  1. +4 −0 app/models/project.rb
View
@@ -13,6 +13,10 @@ class Project < ActiveRecord::Base
children :stories
+ belongs_to :owner, :class_name => "User", :creator => true, :inverse_of => :projects
+ has_many :memberships, :class_name => "ProjectMembership", :dependent => :destroy, :inverse_of => :project
+ has_many :members, :through => :memberships, :source => :user
+
belongs_to :owner, :class_name => "User", :creator => true, :inverse_of => :projects
# --- Permissions --- #

0 comments on commit 2286479

Please sign in to comment.