aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJosh Kalderimis <josh.kalderimis@gmail.com>2011-05-25 02:28:41 +0200
committerJosh Kalderimis <josh.kalderimis@gmail.com>2011-05-25 02:29:32 +0200
commit542114e1d82fffa1062ef0eaa1053959ab9d14ec (patch)
treebbeecf790f95cef0f33c7dd4fd029aef3cc1eb90 /activerecord/lib
parent52e01fc59dfcadaa0fd7773fb4d9a04dff297ce8 (diff)
downloadrails-542114e1d82fffa1062ef0eaa1053959ab9d14ec.tar.gz
rails-542114e1d82fffa1062ef0eaa1053959ab9d14ec.tar.bz2
rails-542114e1d82fffa1062ef0eaa1053959ab9d14ec.zip
removed deprecated methods, and related tests, from ActiveRecord
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/builder/singular_association.rb13
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb24
-rw-r--r--activerecord/lib/active_record/base.rb17
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb31
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb18
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb18
-rw-r--r--activerecord/lib/active_record/fixtures.rb4
-rw-r--r--activerecord/lib/active_record/reflection.rb6
8 files changed, 4 insertions, 127 deletions
diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb
index 638a2ec72a..0cbbba041a 100644
--- a/activerecord/lib/active_record/associations/builder/singular_association.rb
+++ b/activerecord/lib/active_record/associations/builder/singular_association.rb
@@ -13,19 +13,6 @@ module ActiveRecord::Associations::Builder
private
- def define_readers
- super
- name = self.name
-
- model.redefine_method("#{name}_loaded?") do
- ActiveSupport::Deprecation.warn(
- "Calling obj.#{name}_loaded? is deprecated. Please use " \
- "obj.association(:#{name}).loaded? instead."
- )
- association(name).loaded?
- end
- end
-
def define_constructors
name = self.name
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index 8415942a1a..adfc71d435 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -123,30 +123,6 @@ module ActiveRecord
method_missing(:new, *args, &block)
end
end
-
- def proxy_owner
- ActiveSupport::Deprecation.warn(
- "Calling record.#{@association.reflection.name}.proxy_owner is deprecated. Please use " \
- "record.association(:#{@association.reflection.name}).owner instead."
- )
- @association.owner
- end
-
- def proxy_target
- ActiveSupport::Deprecation.warn(
- "Calling record.#{@association.reflection.name}.proxy_target is deprecated. Please use " \
- "record.association(:#{@association.reflection.name}).target instead."
- )
- @association.target
- end
-
- def proxy_reflection
- ActiveSupport::Deprecation.warn(
- "Calling record.#{@association.reflection.name}.proxy_reflection is deprecated. Please use " \
- "record.association(:#{@association.reflection.name}).reflection instead."
- )
- @association.reflection
- end
end
end
end
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 99930e7697..f6a80b8bce 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1662,9 +1662,6 @@ MSG
# If any attributes are protected by either +attr_protected+ or
# +attr_accessible+ then only settable attributes will be assigned.
#
- # The +guard_protected_attributes+ argument is now deprecated, use
- # the +assign_attributes+ method if you want to bypass mass-assignment security.
- #
# class User < ActiveRecord::Base
# attr_protected :is_admin
# end
@@ -1673,20 +1670,10 @@ MSG
# user.attributes = { :username => 'Phusion', :is_admin => true }
# user.username # => "Phusion"
# user.is_admin? # => false
- def attributes=(new_attributes, guard_protected_attributes = nil)
- unless guard_protected_attributes.nil?
- message = "the use of 'guard_protected_attributes' will be removed from the next major release of rails, " +
- "if you want to bypass mass-assignment security then look into using assign_attributes"
- ActiveSupport::Deprecation.warn(message)
- end
-
+ def attributes=(new_attributes)
return unless new_attributes.is_a?(Hash)
- if guard_protected_attributes == false
- assign_attributes(new_attributes, :without_protection => true)
- else
- assign_attributes(new_attributes)
- end
+ assign_attributes(new_attributes)
end
# Allows you to set all the attributes for a particular mass-assignment
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index b3eb23bbb3..ab85171e11 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/module/deprecation'
-
module ActiveRecord
module ConnectionAdapters # :nodoc:
module DatabaseStatements
@@ -245,31 +243,6 @@ module ActiveRecord
# done if the transaction block raises an exception or returns false.
def rollback_db_transaction() end
- # Appends +LIMIT+ and +OFFSET+ options to an SQL statement, or some SQL
- # fragment that has the same semantics as LIMIT and OFFSET.
- #
- # +options+ must be a Hash which contains a +:limit+ option
- # and an +:offset+ option.
- #
- # This method *modifies* the +sql+ parameter.
- #
- # This method is deprecated!! Stop using it!
- #
- # ===== Examples
- # add_limit_offset!('SELECT * FROM suppliers', {:limit => 10, :offset => 50})
- # generates
- # SELECT * FROM suppliers LIMIT 10 OFFSET 50
- def add_limit_offset!(sql, options)
- if limit = options[:limit]
- sql << " LIMIT #{sanitize_limit(limit)}"
- end
- if offset = options[:offset]
- sql << " OFFSET #{offset.to_i}"
- end
- sql
- end
- deprecate :add_limit_offset!
-
def default_sequence_name(table, column)
nil
end
@@ -308,10 +281,10 @@ module ActiveRecord
# Sanitizes the given LIMIT parameter in order to prevent SQL injection.
#
# The +limit+ may be anything that can evaluate to a string via #to_s. It
- # should look like an integer, or a comma-delimited list of integers, or
+ # should look like an integer, or a comma-delimited list of integers, or
# an Arel SQL literal.
#
- # Returns Integer and Arel::Nodes::SqlLiteral limits as is.
+ # Returns Integer and Arel::Nodes::SqlLiteral limits as is.
# Returns the sanitized limit parameter, either as an integer, or as a
# string which contains a comma-delimited list of integers.
def sanitize_limit(limit)
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index bbaac29e5a..6e2c3f4527 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -347,19 +347,6 @@ module ActiveRecord
execute("RELEASE SAVEPOINT #{current_savepoint_name}")
end
- def add_limit_offset!(sql, options)
- limit, offset = options[:limit], options[:offset]
- if limit && offset
- sql << " LIMIT #{offset.to_i}, #{sanitize_limit(limit)}"
- elsif limit
- sql << " LIMIT #{sanitize_limit(limit)}"
- elsif offset
- sql << " OFFSET #{offset.to_i}"
- end
- sql
- end
- deprecate :add_limit_offset!
-
# SCHEMA STATEMENTS ========================================
def structure_dump
@@ -582,11 +569,6 @@ module ActiveRecord
pk_and_sequence && pk_and_sequence.first
end
- def case_sensitive_equality_operator
- "= BINARY"
- end
- deprecate :case_sensitive_equality_operator
-
def case_sensitive_modifier(node)
Arel::Nodes::Bin.new(node)
end
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index a3704fe54a..237575553a 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -487,19 +487,6 @@ module ActiveRecord
execute("RELEASE SAVEPOINT #{current_savepoint_name}")
end
- def add_limit_offset!(sql, options) #:nodoc:
- limit, offset = options[:limit], options[:offset]
- if limit && offset
- sql << " LIMIT #{offset.to_i}, #{sanitize_limit(limit)}"
- elsif limit
- sql << " LIMIT #{sanitize_limit(limit)}"
- elsif offset
- sql << " OFFSET #{offset.to_i}"
- end
- sql
- end
- deprecate :add_limit_offset!
-
# SCHEMA STATEMENTS ========================================
def structure_dump #:nodoc:
@@ -712,11 +699,6 @@ module ActiveRecord
pk_and_sequence && pk_and_sequence.first
end
- def case_sensitive_equality_operator
- "= BINARY"
- end
- deprecate :case_sensitive_equality_operator
-
def case_sensitive_modifier(node)
Arel::Nodes::Bin.new(node)
end
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 1f31722a7c..50b2852659 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -12,7 +12,6 @@ require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/logger'
require 'active_support/ordered_hash'
-require 'active_support/core_ext/module/deprecation'
require 'active_record/fixtures/file'
if defined? ActiveRecord
@@ -393,9 +392,6 @@ class FixturesFileNotFound < StandardError; end
#
# Any fixture labeled "DEFAULTS" is safely ignored.
-Fixture = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Fixture', 'ActiveRecord::Fixture')
-Fixtures = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Fixtures', 'ActiveRecord::Fixtures')
-
module ActiveRecord
class Fixtures
MAX_ID = 2 ** 30 - 1
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index b1bb1b0f7f..eff1be745a 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -1,5 +1,4 @@
require 'active_support/core_ext/class/attribute'
-require 'active_support/core_ext/module/deprecation'
require 'active_support/core_ext/object/inclusion'
module ActiveRecord
@@ -202,11 +201,6 @@ module ActiveRecord
@foreign_key ||= options[:foreign_key] || derive_foreign_key
end
- def primary_key_name
- foreign_key
- end
- deprecate :primary_key_name => :foreign_key
-
def foreign_type
@foreign_type ||= options[:foreign_type] || "#{name}_type"
end