parent
f26ccac3b9
commit
d575ce5e5f
@ -0,0 +1,7 @@
|
|||||||
|
class MessageAll < ActiveRecord::Base
|
||||||
|
attr_accessible :container_id, :container_type, :message_id, :message_type
|
||||||
|
# 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表
|
||||||
|
belongs_to :message ,:polymorphic => true
|
||||||
|
# 虚拟关联---项目/课程
|
||||||
|
belongs_to :container ,:polymorphic => true
|
||||||
|
end
|
@ -0,0 +1,12 @@
|
|||||||
|
class CreateMessageAlls < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :message_alls do |t|
|
||||||
|
t.string :message_type
|
||||||
|
t.integer :message_id
|
||||||
|
t.string :container_type
|
||||||
|
t.integer :container_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,9 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :message_all do
|
||||||
|
message_type "MyString"
|
||||||
|
message_id 1
|
||||||
|
container_type "MyString"
|
||||||
|
container_id 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe MessageAll, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue