aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb1
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb19
-rwxr-xr-xactiverecord/lib/active_record/base.rb11
-rw-r--r--activerecord/lib/active_record/deprecated_associations.rb11
-rw-r--r--activerecord/lib/active_record/deprecated_finders.rb44
5 files changed, 2 insertions, 84 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index c1e93116d5..d30756b9c7 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1205,7 +1205,6 @@ module ActiveRecord
deprecated_remove_association_relation(association_name)
deprecated_has_collection_method(association_name)
deprecated_find_in_collection_method(association_name)
- deprecated_find_all_in_collection_method(association_name)
deprecated_collection_create_method(association_name)
deprecated_collection_build_method(association_name)
end
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb
index 3ea8187cb8..1c96353863 100644
--- a/activerecord/lib/active_record/associations/has_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_association.rb
@@ -20,25 +20,6 @@ module ActiveRecord
end
end
- # DEPRECATED.
- def find_all(runtime_conditions = nil, orderings = nil, limit = nil, joins = nil)
- if @reflection.options[:finder_sql]
- @reflection.klass.find_by_sql(@finder_sql)
- else
- conditions = @finder_sql
- conditions += " AND (#{sanitize_sql(runtime_conditions)})" if runtime_conditions
- orderings ||= @reflection.options[:order]
- @reflection.klass.find_all(conditions, orderings, limit, joins)
- end
- end
- deprecate :find_all => "use find(:all, ...) instead"
-
- # DEPRECATED. Find the first associated record. All arguments are optional.
- def find_first(conditions = nil, orderings = nil)
- find_all(conditions, orderings, 1).first
- end
- deprecate :find_first => "use find(:first, ...) instead"
-
# Count the number of associated records. All arguments are optional.
def count(*args)
if @reflection.options[:counter_sql]
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 8c7b83f82a..fa34db9c68 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1,7 +1,6 @@
require 'base64'
require 'yaml'
require 'set'
-require 'active_record/deprecated_finders'
module ActiveRecord #:nodoc:
class ActiveRecordError < StandardError #:nodoc:
@@ -1207,7 +1206,7 @@ module ActiveRecord #:nodoc:
# or find_or_create_by_user_and_password(user, password).
def method_missing(method_id, *arguments)
if match = /^find_(all_by|by)_([_a-zA-Z]\w*)$/.match(method_id.to_s)
- finder, deprecated_finder = determine_finder(match), determine_deprecated_finder(match)
+ finder = determine_finder(match)
attribute_names = extract_attribute_names_from_match(match)
super unless all_attributes_exists?(attribute_names)
@@ -1234,9 +1233,7 @@ module ActiveRecord #:nodoc:
end
else
- ActiveSupport::Deprecation.silence do
- send(deprecated_finder, sanitize_sql(attributes), *arguments[attribute_names.length..-1])
- end
+ raise ArgumentError, "Unrecognized arguments for #{method_id}: #{extra_options.inspect}"
end
elsif match = /^find_or_(initialize|create)_by_([_a-zA-Z]\w*)$/.match(method_id.to_s)
instantiator = determine_instantiator(match)
@@ -1262,10 +1259,6 @@ module ActiveRecord #:nodoc:
match.captures.first == 'all_by' ? :find_every : :find_initial
end
- def determine_deprecated_finder(match)
- match.captures.first == 'all_by' ? :find_all : :find_first
- end
-
def determine_instantiator(match)
match.captures.first == 'initialize' ? :new : :create
end
diff --git a/activerecord/lib/active_record/deprecated_associations.rb b/activerecord/lib/active_record/deprecated_associations.rb
index 01410c4a7b..c973b65dbc 100644
--- a/activerecord/lib/active_record/deprecated_associations.rb
+++ b/activerecord/lib/active_record/deprecated_associations.rb
@@ -49,17 +49,6 @@ module ActiveRecord
end_eval
end
- def deprecated_find_all_in_collection_method(collection_name)# :nodoc:
- module_eval <<-"end_eval", __FILE__, __LINE__
- def find_all_in_#{collection_name}(runtime_conditions = nil, orderings = nil, limit = nil, joins = nil)
- ActiveSupport::Deprecation.silence do
- #{collection_name}.find_all(runtime_conditions, orderings, limit, joins)
- end
- end
- deprecate :find_all_in_#{collection_name} => "use #{collection_name}.find(:all, ...) instead"
- end_eval
- end
-
def deprecated_collection_create_method(collection_name)# :nodoc:
module_eval <<-"end_eval", __FILE__, __LINE__
def create_in_#{collection_name}(attributes = {})
diff --git a/activerecord/lib/active_record/deprecated_finders.rb b/activerecord/lib/active_record/deprecated_finders.rb
deleted file mode 100644
index d4dcaa3fa0..0000000000
--- a/activerecord/lib/active_record/deprecated_finders.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-module ActiveRecord
- class Base
- class << self
- # DEPRECATION NOTICE: This method is deprecated in favor of find with the :conditions option.
- #
- # Works like find, but the record matching +id+ must also meet the +conditions+.
- # +RecordNotFound+ is raised if no record can be found matching the +id+ or meeting the condition.
- # Example:
- # Person.find_on_conditions 5, "first_name LIKE '%dav%' AND last_name = 'heinemeier'"
- def find_on_conditions(ids, conditions) # :nodoc:
- find(ids, :conditions => conditions)
- end
- deprecate :find_on_conditions => "use find(ids, :conditions => conditions)"
-
- # DEPRECATION NOTICE: This method is deprecated in favor of find(:first, options).
- #
- # Returns the object for the first record responding to the conditions in +conditions+,
- # such as "group = 'master'". If more than one record is returned from the query, it's the first that'll
- # be used to create the object. In such cases, it might be beneficial to also specify
- # +orderings+, like "income DESC, name", to control exactly which record is to be used. Example:
- # Employee.find_first "income > 50000", "income DESC, name"
- def find_first(conditions = nil, orderings = nil, joins = nil) # :nodoc:
- find(:first, :conditions => conditions, :order => orderings, :joins => joins)
- end
- deprecate :find_first => "use find(:first, ...)"
-
- # DEPRECATION NOTICE: This method is deprecated in favor of find(:all, options).
- #
- # Returns an array of all the objects that could be instantiated from the associated
- # table in the database. The +conditions+ can be used to narrow the selection of objects (WHERE-part),
- # such as by "color = 'red'", and arrangement of the selection can be done through +orderings+ (ORDER BY-part),
- # such as by "last_name, first_name DESC". A maximum of returned objects and their offset can be specified in
- # +limit+ with either just a single integer as the limit or as an array with the first element as the limit,
- # the second as the offset. Examples:
- # Project.find_all "category = 'accounts'", "last_accessed DESC", 15
- # Project.find_all ["category = ?", category_name], "created ASC", [15, 20]
- def find_all(conditions = nil, orderings = nil, limit = nil, joins = nil) # :nodoc:
- limit, offset = limit.is_a?(Array) ? limit : [ limit, nil ]
- find(:all, :conditions => conditions, :order => orderings, :joins => joins, :limit => limit, :offset => offset)
- end
- deprecate :find_all => "use find(:all, ...)"
- end
- end
-end