aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/deprecated_associations.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-09-03 00:17:09 +0000
committerMichael Koziarski <michael@koziarski.com>2007-09-03 00:17:09 +0000
commit6246fad19a5ec747f5914c142b8631af212d47ea (patch)
tree7693248f7fd9e42a69bd13b4bbb94c4ed2d576e9 /activerecord/lib/active_record/deprecated_associations.rb
parentf0dbd22c4647bf8e37fd9b58ce6652aaca27376e (diff)
downloadrails-6246fad19a5ec747f5914c142b8631af212d47ea.tar.gz
rails-6246fad19a5ec747f5914c142b8631af212d47ea.tar.bz2
rails-6246fad19a5ec747f5914c142b8631af212d47ea.zip
Remove deprecated functionality from edge rails. Closes #9387 [lifofifo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7402 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/deprecated_associations.rb')
-rw-r--r--activerecord/lib/active_record/deprecated_associations.rb93
1 files changed, 0 insertions, 93 deletions
diff --git a/activerecord/lib/active_record/deprecated_associations.rb b/activerecord/lib/active_record/deprecated_associations.rb
deleted file mode 100644
index c973b65dbc..0000000000
--- a/activerecord/lib/active_record/deprecated_associations.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-module ActiveRecord
- module Associations # :nodoc:
- module ClassMethods
- def deprecated_collection_count_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def #{collection_name}_count(force_reload = false)
- unless has_attribute?(:#{collection_name}_count)
- ActiveSupport::Deprecation.warn :#{collection_name}_count
- end
- #{collection_name}.reload if force_reload
- #{collection_name}.size
- end
- end_eval
- end
-
- def deprecated_add_association_relation(association_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def add_#{association_name}(*items)
- #{association_name}.concat(items)
- end
- deprecate :add_#{association_name} => "use #{association_name}.concat instead"
- end_eval
- end
-
- def deprecated_remove_association_relation(association_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def remove_#{association_name}(*items)
- #{association_name}.delete(items)
- end
- deprecate :remove_#{association_name} => "use #{association_name}.delete instead"
- end_eval
- end
-
- def deprecated_has_collection_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def has_#{collection_name}?(force_reload = false)
- !#{collection_name}(force_reload).empty?
- end
- deprecate :has_#{collection_name}? => "use !#{collection_name}.empty? instead"
- end_eval
- end
-
- def deprecated_find_in_collection_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def find_in_#{collection_name}(association_id)
- #{collection_name}.find(association_id)
- end
- deprecate :find_in_#{collection_name} => "use #{collection_name}.find instead"
- end_eval
- end
-
- def deprecated_collection_create_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def create_in_#{collection_name}(attributes = {})
- #{collection_name}.create(attributes)
- end
- deprecate :create_in_#{collection_name} => "use #{collection_name}.create instead"
- end_eval
- end
-
- def deprecated_collection_build_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def build_to_#{collection_name}(attributes = {})
- #{collection_name}.build(attributes)
- end
- deprecate :build_to_#{collection_name} => "use #{collection_name}.build instead"
- end_eval
- end
-
- def deprecated_association_comparison_method(association_name, association_class_name) # :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def #{association_name}?(comparison_object, force_reload = false)
- if comparison_object.kind_of?(#{association_class_name})
- #{association_name}(force_reload) == comparison_object
- else
- raise "Comparison object is a #{association_class_name}, should have been \#{comparison_object.class.name}"
- end
- end
- deprecate :#{association_name}? => :==
- end_eval
- end
-
- def deprecated_has_association_method(association_name) # :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def has_#{association_name}?(force_reload = false)
- !#{association_name}(force_reload).nil?
- end
- deprecate :has_#{association_name}? => "use !#{association_name} insead"
- end_eval
- end
- end
- end
-end