Module: Frigate::Operation::Renderable

Defined in:
lib/frigate/operation/renderable.rb

Overview

allows operation to be rendered as json for now))

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/frigate/operation/renderable.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#render(ctrl) ⇒ Object

Parameters:

  • ctrl (ActionController::Base)

    An Instance of subclass of ActionController::Base



24
25
26
27
28
29
30
# File 'lib/frigate/operation/renderable.rb', line 24

def render(ctrl)
  ctrl.respond_to do |f|
    f.json do
      ctrl.render status: (model_form.valid? ? 200 : 400), json: build_json(ctrl)
    end
  end
end