Class: ActiveRecord::NamedScope::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/reactive_record/first_last_limits.rb

Instance Method Summary collapse

Instance Method Details

#first(*args) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/reactive_record/first_last_limits.rb', line 110

def first(*args)
  if loaded? && !args.first.kind_of?(Hash)
    to_a.first(*args)
  else
    options = args.extract_options!
    if options.any?
      apply_finder_options(options).first(*args)
    else
      super
    end
  end
end

#last(*args) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/reactive_record/first_last_limits.rb', line 123

def last(*args)
  if loaded? && !args.first.kind_of?(Hash)
    to_a.last(*args)
  else
    options = args.extract_options!
    if options.any?
      apply_finder_options(options).last(*args)
    else
      super
    end
  end
end