Method: Sequel::Model::ClassMethods#first
- Defined in:
- lib/sequel/model/base.rb
#first(*args, &block) ⇒ Object
An alias for calling first on the model’s dataset, but with optimized handling of the single argument case.
571 572 573 574 575 576 577 578 |
# File 'lib/sequel/model/base.rb', line 571 def first(*args, &block) if args.length == 1 && !block && !args.first.is_a?(Integer) # Use optimized finder first_where(args.first) else dataset.first(*args, &block) end end |