internetee-registry/app/models/action.rb
Artur Beljajev fa52001be6 Upgrade to Rails 5.0
Closes #377
2019-11-15 15:26:33 +02:00

19 lines
No EOL
405 B
Ruby

class Action < ApplicationRecord
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