You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
1.1 KiB
16 lines
1.1 KiB
6 years ago
|
class MessageAll < ActiveRecord::Base
|
||
|
attr_accessible :message_id, :message_type, :user_id
|
||
|
belongs_to :user
|
||
|
# 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表
|
||
|
belongs_to :forge_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'ForgeMessage'"
|
||
|
belongs_to :course_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'CourseMessage'"
|
||
|
belongs_to :applied_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'AppliedMessage'"
|
||
|
belongs_to :at_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'AtMessage'"
|
||
|
belongs_to :memo_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'MemoMessage'"
|
||
|
belongs_to :org_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'OrgMessage'"
|
||
|
belongs_to :system_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'SystemMessage'"
|
||
|
belongs_to :user_feedback_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'UserFeedbackMessage'"
|
||
|
belongs_to :message ,:polymorphic => true
|
||
|
|
||
|
end
|