From 7d41072c0e9e733d20b0d2eb83fd64160daf1bae Mon Sep 17 00:00:00 2001 From: Fabio Kreusch Date: Fri, 27 Jul 2012 17:25:21 -0300 Subject: [PATCH] Rails 3.2.7 deprecates update_attribute in favor of update_column. Updated projects using Devise output lots of warnings because Devise uses the deprecated version in some places. This commit replaces update_attribute with update_column to fix that. --- lib/devise/hooks/lockable.rb | 2 +- test/integration/http_authenticatable_test.rb | 2 +- test/integration/recoverable_test.rb | 2 +- test/integration/token_authenticatable_test.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/devise/hooks/lockable.rb b/lib/devise/hooks/lockable.rb index 22d0428e..cb6fb9a5 100644 --- a/lib/devise/hooks/lockable.rb +++ b/lib/devise/hooks/lockable.rb @@ -2,6 +2,6 @@ # This is only triggered when the user is explicitly set (with set_user) Warden::Manager.after_set_user :except => :fetch do |record, warden, options| if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope]) - record.update_attribute(:failed_attempts, 0) + record.update_column(:failed_attempts, 0) end end diff --git a/test/integration/http_authenticatable_test.rb b/test/integration/http_authenticatable_test.rb index 1227c19c..dd82541c 100644 --- a/test/integration/http_authenticatable_test.rb +++ b/test/integration/http_authenticatable_test.rb @@ -73,7 +73,7 @@ class HttpAuthenticationTest < ActionController::IntegrationTest test 'sign in should authenticate with really long token' do token = "token_containing_so_many_characters_that_the_base64_encoding_will_wrap" user = create_user - user.update_attribute :authentication_token, token + user.update_column :authentication_token, token get users_path(:format => :xml), {}, "HTTP_AUTHORIZATION" => "Basic #{Base64.encode64("#{token}:x")}" assert_response :success assert_match "user@test.com", response.body diff --git a/test/integration/recoverable_test.rb b/test/integration/recoverable_test.rb index 9dbadd0a..54ab3c36 100644 --- a/test/integration/recoverable_test.rb +++ b/test/integration/recoverable_test.rb @@ -293,7 +293,7 @@ class PasswordTest < ActionController::IntegrationTest test "after recovering a password, should set failed attempts to 0" do user = create_user - user.update_attribute(:failed_attempts, 10) + user.update_column(:failed_attempts, 10) assert_equal 10, user.failed_attempts request_forgot_password diff --git a/test/integration/token_authenticatable_test.rb b/test/integration/token_authenticatable_test.rb index 17426dbf..5c96780a 100644 --- a/test/integration/token_authenticatable_test.rb +++ b/test/integration/token_authenticatable_test.rb @@ -121,7 +121,7 @@ class TokenAuthenticationTest < ActionController::IntegrationTest @user = nil user2 = create_user_with_authentication_token(:email => "another@test.com") - user2.update_attribute(:authentication_token, "ANOTHERTOKEN") + user2.update_column(:authentication_token, "ANOTHERTOKEN") assert_not_equal user1, user2 visit users_path(Devise.token_authentication_key.to_s + '[$ne]' => user1.authentication_token)