Module: Trailblazer::Operation::Model

Defined in:
lib/trailblazer/operation/model.rb

Defined Under Namespace

Classes: Builder

Class Method Summary collapse

Class Method Details

.for(model_class, action) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/trailblazer/operation/model.rb', line 11

def self.for(model_class, action)
  builder = Model::Builder.new

  ->(input, options) do
    options["model"] = model = builder.(options, options["params"])

    options["result.model"] = result = Result.new(!model.nil?, {})

    result.success?
  end
end