17 lines
560 B
Ruby
17 lines
560 B
Ruby
class UserFeedbackMessage < ActiveRecord::Base
|
|
attr_accessible :journals_for_message_id, :journals_for_message_type, :user_id, :viewed
|
|
|
|
belongs_to :journals_for_message
|
|
belongs_to :user
|
|
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
|
|
|
validates :user_id,presence: true
|
|
validates :journals_for_message_id,presence: true
|
|
validates :journals_for_message_type, presence: true
|
|
after_save :add_user_message
|
|
|
|
def add_user_message
|
|
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
|
end
|
|
end
|