From cae882b3d62b3ae5d0500c9563cca5c19dc58141 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 May 2015 14:44:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E8=A1=A8=20=E7=9B=B8=E5=85=B3=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/invite_list.rb | 5 +++++ app/models/project.rb | 2 +- app/models/user.rb | 4 ++++ db/migrate/20150528024616_create_invite_lists.rb | 10 ++++++++++ spec/factories/invite_lists.rb | 7 +++++++ spec/models/invite_list_spec.rb | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/models/invite_list.rb create mode 100644 db/migrate/20150528024616_create_invite_lists.rb create mode 100644 spec/factories/invite_lists.rb create mode 100644 spec/models/invite_list_spec.rb 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