Class: Frigate::Operation::Action::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/frigate/operation/action/create.rb

Overview

Is here to perform create action of operation

Instance Attribute Summary

Attributes inherited from Base

#action_result, #model, #model_form, #operation, #opts, #params

Instance Method Summary collapse

Methods inherited from Base

#initialize, run, #run

Constructor Details

This class inherits a constructor from Frigate::Operation::Action::Base

Instance Method Details

#actionObject

An create action is defined in here



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/frigate/operation/action/create.rb', line 7

def action
	@model = model_klass.new
	@model_form = create_form(model)
	if model_form.validate(params)
		if operation_block
			operation_block(model, params)
		else
			model_form.sync_with_model(save: true)
		end
	end
end