module Frigate::Operation::Controller::Helpers

Helpers for rails controllers

Public Instance Methods

invalid_params_error(exception) click to toggle source
# File lib/frigate/operation/controller.rb, line 13
def invalid_params_error(exception)
        respond_to do |f|
                f.json do
                        render status: 400, json: {
                                        status: 'error',
                                        data: exception.errors.messages
                                }
                end
        end
end
render_operation(*args) click to toggle source

render-operation helps to render operation data @param [Frigate::Operation] klass @param [Hash] params

# File lib/frigate/operation/controller.rb, line 35
def render_operation(*args)
        run_operation(*args).render(self)
        # raise run_operation(*args).errors.messages.inspect
end
run_operation(klass, params) click to toggle source

run-operation helps to run operation elegantly @param [Frigate::Operation] klass @param [Hash] params

# File lib/frigate/operation/controller.rb, line 28
def run_operation(klass, params)
        klass.run(params)
end