Class: ApplicationAction

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/application_action.rb,
lib/application_action/version.rb

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#runObject



16
17
18
# File 'lib/application_action.rb', line 16

def run
  raise 'You should write your own #run method'
end

#saveObject



4
5
6
7
8
9
10
# File 'lib/application_action.rb', line 4

def save
  return false unless valid?

  ApplicationRecord.transaction { run }

  return true
end

#save!Object



12
13
14
# File 'lib/application_action.rb', line 12

def save!
  raise errors.full_messages.join(', ') unless save
end