This commit is contained in:
r888888888
2014-03-05 17:47:40 -08:00
parent 56ae78f963
commit 37d75e4a88
3 changed files with 39 additions and 4 deletions

View File

@@ -3,7 +3,8 @@ class UserFeedback < ActiveRecord::Base
belongs_to :user
belongs_to :creator, :class_name => "User"
before_validation :initialize_creator, :on => :create
attr_accessible :body, :user_id, :category, :user_name
attr_accessor :disable_dmail_notification
attr_accessible :body, :user_id, :category, :user_name, :disable_dmail_notification
validates_presence_of :user, :creator, :body, :category
validates_inclusion_of :category, :in => %w(positive negative neutral)
validate :creator_is_gold
@@ -74,8 +75,10 @@ class UserFeedback < ActiveRecord::Base
end
def create_dmail
body = %{#{creator_name} created a "#{category} record":/user_feedbacks?search[user_id]=#{user_id} for your account. #{body}}
Dmail.create_split(:to_id => user_id, :title => "Your user record has been updated", :body => body)
unless disable_dmail_notification
body = %{#{creator_name} created a "#{category} record":/user_feedbacks?search[user_id]=#{user_id} for your account. #{body}}
Dmail.create_split(:to_id => user_id, :title => "Your user record has been updated", :body => body)
end
end
def creator_is_gold