-
Notifications
You must be signed in to change notification settings - Fork 9
Macro::Model
Vladislav Trotsenko edited this page Sep 29, 2019
·
1 revision
Provides to assign model into context. Supports assign by relation chain, relation find_by
.
class SomeOperation < ApplicationOperation
step ->(ctx, **) { ctx[:some_model] = SomeModel.create }
step Macro::Model(
entity: :some_model, connections: %i[sub_object items], find_by_key: :id, params_key: :value
) # ctx[:model] = ctx[:some_model].sub_object.items.find_by(id: :value)
end
class SomeOperation < ApplicationOperation
step ->(ctx, **) { ctx[:some_model] = SomeModel.create }
step Macro::Model(
entity: :some_model, connections: %i[sub_object items], assign: true
) # ctx[:model] = ctx[:some_model].sub_object.items
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!