From 4efebdedf8d8b8e2be711fafb560daddb15e48ad Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 20 Jul 2012 17:59:27 +0100 Subject: Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql. --- .../associations/builder/collection_association.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/lib/active_record/associations/builder/collection_association.rb') diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index af81af4ad2..dbddae0876 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + module ActiveRecord::Associations::Builder class CollectionAssociation < Association #:nodoc: CALLBACKS = [:before_add, :after_add, :before_remove, :after_remove] @@ -14,6 +16,7 @@ module ActiveRecord::Associations::Builder end def build + show_deprecation_warnings wrap_block_extension reflection = super CALLBACKS.each { |callback_name| define_callback(callback_name) } @@ -24,6 +27,14 @@ module ActiveRecord::Associations::Builder 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 + private def wrap_block_extension -- cgit v1.2.3