Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #11222 from neerajdotname/removed-deprecation-for-sql

Removed deprecated options for assocations
  • Loading branch information...
commit 11c2e80babdca378dc035d1529ea336004c72d75 2 parents 6518f12 + a8c888c
@rafaelfranca rafaelfranca authored
View
8 activerecord/CHANGELOG.md
@@ -1,3 +1,11 @@
+* Removed deprecated options `delete_sql` and `insert_sql` from HABTM
+ association.
+
+ Removed deprecated options `finder_sql` and `counter_sql` from
+ collection association.
+
+ *Neeraj Singh*
+
* Remove deprecated `ActiveRecord::Base#connection` method.
Make sure to access it via the class.
View
9 activerecord/lib/active_record/associations/builder/collection_association.rb
@@ -20,7 +20,6 @@ def initialize(*args, &extension)
end
def build
- show_deprecation_warnings
wrap_block_extension
reflection = super
CALLBACKS.each { |callback_name| define_callback(callback_name) }
@@ -31,14 +30,6 @@ def writable?
true
end
- def show_deprecation_warnings
- [:finder_sql, :counter_sql].each do |name|
- if options.include? name
- ActiveSupport::Deprecation.warn("The :#{name} association option is deprecated. Please find an alternative (such as using scopes).")
- end
- end
- end
-
def wrap_block_extension
if block_extension
@extension_module = mod = Module.new(&block_extension)
View
10 activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
@@ -14,16 +14,6 @@ def build
reflection
end
- def show_deprecation_warnings
- super
-
- [:delete_sql, :insert_sql].each do |name|
- if options.include? name
- ActiveSupport::Deprecation.warn("The :#{name} association option is deprecated. Please find an alternative (such as using has_many :through).")
- end
- end
- end
-
def define_destroy_hook
name = self.name
model.send(:include, Module.new {
View
12 activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -845,18 +845,6 @@ def test_include_method_in_has_and_belongs_to_many_association_should_return_tru
assert project.developers.include?(developer)
end
- test ":insert_sql is deprecated" do
- klass = Class.new(ActiveRecord::Base)
- def klass.name; 'Foo'; end
- assert_deprecated { klass.has_and_belongs_to_many :posts, :insert_sql => 'lol' }
- end
-
- test ":delete_sql is deprecated" do
- klass = Class.new(ActiveRecord::Base)
- def klass.name; 'Foo'; end
- assert_deprecated { klass.has_and_belongs_to_many :posts, :delete_sql => 'lol' }
- end
-
test "has and belongs to many associations on new records use null relations" do
projects = Developer.new.projects
assert_no_queries do
View
10 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1774,16 +1774,6 @@ def test_collection_association_with_private_kernel_method
end
end
- test ":finder_sql is deprecated" do
- klass = Class.new(ActiveRecord::Base)
- assert_deprecated { klass.has_many :foo, :finder_sql => 'lol' }
- end
-
- test ":counter_sql is deprecated" do
- klass = Class.new(ActiveRecord::Base)
- assert_deprecated { klass.has_many :foo, :counter_sql => 'lol' }
- end
-
test "has many associations on new records use null relations" do
post = Post.new

2 comments on commit 11c2e80

@neerajdotname
Collaborator

@rafaelfranca just noticed that AR still supports usage of finder_sql, delete_sql, insert_sql and counter_sql. Should I work on removing support for those?

@rafaelfranca

Ahh, yes. that is true. We need to remove the code too.

Please sign in to comment.
Something went wrong with that request. Please try again.