Class: Trailblazer::Macro::Model::Find::KeywordArguments
- Inherits:
-
Object
- Object
- Trailblazer::Macro::Model::Find::KeywordArguments
- Defined in:
- lib/trailblazer/macro/model/find.rb
Instance Method Summary collapse
- #call(ctx, id:) ⇒ Object
-
#initialize(model_class:, find_method:, column_key:) ⇒ KeywordArguments
constructor
A new instance of KeywordArguments.
Constructor Details
#initialize(model_class:, find_method:, column_key:) ⇒ KeywordArguments
Returns a new instance of KeywordArguments.
148 149 150 151 152 |
# File 'lib/trailblazer/macro/model/find.rb', line 148 def initialize(model_class:, find_method:, column_key:) @model_class = model_class @find_method = find_method @column_key = column_key.to_sym end |
Instance Method Details
#call(ctx, id:) ⇒ Object
154 155 156 |
# File 'lib/trailblazer/macro/model/find.rb', line 154 def call(ctx, id:, **) ctx[:model] = @model_class.send(@find_method, @column_key => id) end |