Method: ActiveRecord::ClassMethods#finder_method

Defined in:
lib/reactive_record/active_record/class_methods.rb

#finder_method(name) ⇒ Object



263
264
265
266
267
268
269
270
# File 'lib/reactive_record/active_record/class_methods.rb', line 263

def finder_method(name)
  ReactiveRecord::ScopeDescription.new(self, "_#{name}", {})
  [name, "#{name}!"].each do |method|
    singleton_class.send(:define_method, method) do |*vargs|
      all.apply_scope("_#{method}", *vargs).first
    end
  end
end