Class: Trailblazer::Operation::Model::Builder
- Inherits:
-
Object
- Object
- Trailblazer::Operation::Model::Builder
- Defined in:
- lib/trailblazer/operation/model.rb
Instance Method Summary collapse
- #call(options, params) ⇒ Object
- #find!(model_class, params) ⇒ Object
-
#find_by!(model_class, params) ⇒ Object
Doesn’t throw an exception and will return false to divert to Left.
- #new!(model_class, params) ⇒ Object
Instance Method Details
#call(options, params) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/trailblazer/operation/model.rb', line 24 def call(, params) deprecate_update!() action = ["model.action"] || :new model_class = ["model.class"] send("#{action}!", model_class, params) end |
#find!(model_class, params) ⇒ Object
36 37 38 |
# File 'lib/trailblazer/operation/model.rb', line 36 def find!(model_class, params) model_class.find(params[:id]) end |
#find_by!(model_class, params) ⇒ Object
Doesn’t throw an exception and will return false to divert to Left.
41 42 43 |
# File 'lib/trailblazer/operation/model.rb', line 41 def find_by!(model_class, params) model_class.find_by(id: params[:id]) end |
#new!(model_class, params) ⇒ Object
32 33 34 |
# File 'lib/trailblazer/operation/model.rb', line 32 def new!(model_class, params) model_class.new end |