Module: ActiveRecord::DynamicMatchers::FindByDeprecationWarning

Included in:
FindBy, FindByBang
Defined in:
lib/active_record/deprecated_finders/dynamic_matchers.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/active_record/deprecated_finders/dynamic_matchers.rb', line 33

def body
  "    if block_given?\n      ActiveSupport::Deprecation.warn(\"Calling find_by or find_by! methods with a block is deprecated with no replacement.\")\n    end\n\n    unless options.empty?\n      ActiveSupport::Deprecation.warn(\n        \"Calling find_by or find_by! methods with options is deprecated. \" \\\n        \"Build a scope instead, e.g. User.where('age > 21').find_by_name('Jon').\"\n      )\n    end\n\n    \#{super}\n  CODE\nend\n"