module ActiveRecord::DynamicMatchers::FindByDeprecationWarning

Public Instance Methods

body() click to toggle source
# File lib/active_record/deprecated_finders/dynamic_matchers.rb, line 33
def body
  <<-CODE
    if block_given?
      ActiveSupport::Deprecation.warn("Calling find_by or find_by! methods with a block is deprecated with no replacement.")
    end

    unless options.empty?
      ActiveSupport::Deprecation.warn(
        "Calling find_by or find_by! methods with options is deprecated. " \
        "Build a scope instead, e.g. User.where('age > 21').find_by_name('Jon')."
      )
    end

    #{super}
  CODE
end