Class: Trailblazer::Operation::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/trailblazer/operation/finder.rb

Defined Under Namespace

Classes: Builder

Instance Method Summary collapse

Instance Method Details

#call(ctx, **options) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/trailblazer/operation/finder.rb', line 16

def call(ctx, **options)
  builder = Finder::Builder.new
  ctx[:finder] = finder = builder.call(options, options[:params])
  ctx[:model] = finder # Don't like it, but somehow it's needed if contracts are loaded
  ctx[:"result.finder"] = Result.new(!finder.nil?, {})

  ctx[:"result.finder"].success?
end