internetee-registry/app/models/action.rb
2019-06-26 19:06:21 +03:00

19 lines
No EOL
406 B
Ruby

class Action < ActiveRecord::Base
has_paper_trail class_name: 'ActionVersion'
belongs_to :user
belongs_to :contact
validates :operation, inclusion: { in: proc { |action| action.class.valid_operations } }
class << self
def valid_operations
%w[update]
end
end
def notification_key
raise 'Action object is missing' unless contact
"contact_#{operation}".to_sym
end
end