mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
17 lines
No EOL
359 B
Ruby
17 lines
No EOL
359 B
Ruby
class Action < ActiveRecord::Base
|
|
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 |