GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Deprecate AR::Base#attributes argument

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
fcheung (author)
Sun May 11 16:25:47 -0700 2008
lifo (committer)
Sun May 11 16:26:15 -0700 2008
commit  642da856d5dddbef4141f759e6e2bf57d5a3a3a8
tree    0642b1e838f31097c017903cea8a5be17cd551f3
parent  63edc022f12713b1ac170331a1b619fbcc064d5a
...
2145
2146
2147
 
2148
2149
2150
...
2145
2146
2147
2148
2149
2150
2151
0
@@ -2145,6 +2145,7 @@ module ActiveRecord #:nodoc:
0
         if options.nil?
0
           attributes
0
         else
0
+ ActiveSupport::Deprecation.warn "Passing options to Base#attributes is deprecated and will be removed in Rails 2.1. Please use Hash#slice or Hash#except instead"
0
           if except = options[:except]
0
             except = Array(except).collect { |attribute| attribute.to_s }
0
             except.each { |attribute_name| attributes.delete(attribute_name) }
...
1706
1707
1708
1709
1710
1711
1712
 
 
 
 
 
1713
1714
1715
1716
1717
 
 
 
 
 
1718
1719
1720
1721
1722
 
 
 
 
1723
1724
1725
...
1706
1707
1708
 
 
 
 
1709
1710
1711
1712
1713
1714
 
 
 
 
1715
1716
1717
1718
1719
1720
1721
1722
 
 
1723
1724
1725
1726
1727
1728
1729
0
@@ -1706,20 +1706,24 @@ class BasicsTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_except_attributes
0
- assert_equal(
0
- %w( author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read),
0
- topics(:first).attributes(:except => :title).keys
0
- )
0
+ assert_deprecated do
0
+ assert_equal(
0
+ %w( author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read),
0
+ topics(:first).attributes(:except => :title).keys
0
+ )
0
 
0
- assert_equal(
0
- %w( replies_count bonus_time written_on content author_email_address parent_id last_read),
0
- topics(:first).attributes(:except => [ :title, :id, :type, :approved, :author_name ]).keys
0
- )
0
+ assert_equal(
0
+ %w( replies_count bonus_time written_on content author_email_address parent_id last_read),
0
+ topics(:first).attributes(:except => [ :title, :id, :type, :approved, :author_name ]).keys
0
+ )
0
+ end
0
   end
0
   
0
   def test_include_attributes
0
- assert_equal(%w( title ), topics(:first).attributes(:only => :title).keys)
0
- assert_equal(%w( title author_name type id approved ), topics(:first).attributes(:only => [ :title, :id, :type, :approved, :author_name ]).keys)
0
+ assert_deprecated do
0
+ assert_equal(%w( title ), topics(:first).attributes(:only => :title).keys)
0
+ assert_equal(%w( title author_name type id approved ), topics(:first).attributes(:only => [ :title, :id, :type, :approved, :author_name ]).keys)
0
+ end
0
   end
0
   
0
   def test_type_name_with_module_should_handle_beginning

Comments

    No one has commented yet.