Module: ServiceController::RestActions

Extended by:
ActiveSupport::Concern
Defined in:
app/concerns/service_controller/rest_actions.rb

Instance Method Summary collapse

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/concerns/service_controller/rest_actions.rb', line 24

def call
  @result = execute_service
  if @result.success?

    if respond_to?(:after_success_location)
      redirect_to(after_success_location, notice: success_message)
    else
      flash.now[:success] = success_message
      render :success
    end
  else
    render :invoke
  end
end

#indexObject



17
18
# File 'app/concerns/service_controller/rest_actions.rb', line 17

def index
end

#invokeObject



20
21
22
# File 'app/concerns/service_controller/rest_actions.rb', line 20

def invoke
  respond_with @service
end