diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb new file mode 100644 index 000000000..605c35a07 --- /dev/null +++ b/app/models/invite_list.rb @@ -0,0 +1,5 @@ +class InviteList < ActiveRecord::Base + attr_accessible :project_id, :user_id + belongs_to :user + belongs_to :project +end diff --git a/app/models/project.rb b/app/models/project.rb index 47878dbec..249df8640 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -67,7 +67,7 @@ class Project < ActiveRecord::Base has_many :student, :through => :students_for_courses, :source => :user has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects - + has_many :invite_lists # end #ADDED BY NIE diff --git a/app/models/user.rb b/app/models/user.rb index 7b232bf13..fa3134a58 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -125,6 +125,10 @@ class User < Principal has_many :documents # 项目中关联的文档再次与人关联 # end + # 邮件邀请状态 + has_many :invite_lists + # end + ######added by nie has_many :project_infos, :dependent => :destroy has_one :user_status, :dependent => :destroy diff --git a/db/migrate/20150528024616_create_invite_lists.rb b/db/migrate/20150528024616_create_invite_lists.rb new file mode 100644 index 000000000..222a3a3f8 --- /dev/null +++ b/db/migrate/20150528024616_create_invite_lists.rb @@ -0,0 +1,10 @@ +class CreateInviteLists < ActiveRecord::Migration + def change + create_table :invite_lists do |t| + t.integer :project_id + t.integer :user_id + + t.timestamps + end + end +end diff --git a/spec/factories/invite_lists.rb b/spec/factories/invite_lists.rb new file mode 100644 index 000000000..c9ce0e826 --- /dev/null +++ b/spec/factories/invite_lists.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :invite_list do + project_id 1 +user_id 1 + end + +end diff --git a/spec/models/invite_list_spec.rb b/spec/models/invite_list_spec.rb new file mode 100644 index 000000000..8da327964 --- /dev/null +++ b/spec/models/invite_list_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe InviteList, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end