35 lines
784 B
Ruby
35 lines
784 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: feedback_message_histories
|
|
#
|
|
# id :integer not null, primary key
|
|
# feedback_id :integer
|
|
# user_id :integer
|
|
# title :string(255)
|
|
# content :text(65535)
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_feedback_message_histories_on_feedback_id (feedback_id)
|
|
# index_feedback_message_histories_on_user_id (user_id)
|
|
#
|
|
|
|
class FeedbackMessageHistory < ApplicationRecord
|
|
|
|
belongs_to :feedback
|
|
belongs_to :user
|
|
|
|
before_validation :send_meessage_email, on: :create
|
|
|
|
private
|
|
|
|
def send_meessage_email
|
|
unless UserMailer.update_email(mail, verification_code).deliver_now
|
|
errors[:title] << '邮件发送失败!'
|
|
end
|
|
end
|
|
|
|
end
|