Only pass `:distinct` if it was specified.
require minitest/autorun before minitest/spec to get rid of warnings.
This removes the following warning: ``` Warning: you should require 'minitest/autorun' instead. Warning: or add 'gem "minitest"' before 'require "minitest/autorun"' From: /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/minitest-5.1.0/lib/minitest/spec.rb:3:in `require' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/minitest-5.1.0/lib/minitest/spec.rb:3:in `<top (required)>' /Users/senny/Projects/activerecord-deprecated_finders/test/helper.rb:2:in `require' /Users/senny/Projects/activerecord-deprecated_finders/test/helper.rb:2:in `<top (required)>' /Users/senny/Projects/activerecord-deprecated_finders/test/associations_test.rb:1:in `require' /Users/senny/Projects/activerecord-deprecated_finders/test/associations_test.rb:1:in `<top (required)>' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:10:in `require' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:9:in `each' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:9:in `block in <main>' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:4:in `select' /Users/senny/Projects/activerecord-deprecated_finders/gemfiles/.bundle/gems/rake-10.1.0/lib/rake/rake_test_loader.rb:4:in `<main>' ```
This prevents `:distinct` deprecation warnings when the option was not passed at all. The prevented deprecation looks like: ``` DEPRECATION WARNING: The :distinct option for `Relation#count` is deprecated. Please use `Relation#distinct` instead. (eg. `relation.distinct.count`). (called from calculate at /Users/max/Projects/activerecord-deprecated_finders/lib/active_record/deprecated_finders/relation.rb:84) ``` This issue was discovered while working on: rails/rails#13165
filling in some gaps in the documentation [ci skip]
Show the project path in depreaction warning instead of lib file.
better fix for #9994
fixes rails/rails#10304 Fix for #9994 is already applied but it is causing problems. Previous fix took the approach of applying checking if the `CollectionProxy` responds to a method or not. If it does then invoke the method on `CollectionProxy` instance. This was needed so that the association record could be created for hm:t . However this approach is causing problem. If someone defines a method called `find_by_anything` on base class then this method is invoked on `CollectionProxy` first. And that's wrong. In this PR the approach is to send the method to base class and if the association is of type hm:t and if the method is `find_or_create` or `find_or_creat!` then invoke. `save_through_record` on the `proxy_association`.
fix failing tests
test for previously comitted code
Raise error when mixing block scope with deprecated options
method should first be invoked on CollectionProxy
Use the correct gemspec so SQLite3 gets pulled in with bundle install
This is fix for rails/rails#9994
Now the symbol in onder is always expanded to prepend the quoted table name Closes #5