Skip to content
Browse files

sign_in_count shoud default to zero.

  • Loading branch information...
1 parent 867e896 commit e2793fc69eb8fa416121f436f902669a90363ea8 @josevalim josevalim committed
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/devise/schema.rb
  2. +1 −1 test/integration/trackable_test.rb
View
4 lib/devise/schema.rb
@@ -44,7 +44,7 @@ def rememberable
# Creates sign_in_count, current_sign_in_at, last_sign_in_at,
# current_sign_in_ip, last_sign_in_ip.
def trackable
- apply_schema :sign_in_count, Integer
+ apply_schema :sign_in_count, Integer, :default => 0
apply_schema :current_sign_in_at, DateTime
apply_schema :last_sign_in_at, DateTime
apply_schema :current_sign_in_ip, String
@@ -54,7 +54,7 @@ def trackable
# Creates failed_attempts, unlock_token and locked_at
def lockable
apply_schema :failed_attempts, Integer, :default => 0
- apply_schema :unlock_token, String, :limit => 20
+ apply_schema :unlock_token, String, :limit => 20
apply_schema :locked_at, DateTime
end
View
2 test/integration/trackable_test.rb
@@ -39,7 +39,7 @@ class TrackableHooksTest < ActionController::IntegrationTest
test "increase sign in count" do
user = create_user
- assert_nil user.sign_in_count
+ assert_equal 0, user.sign_in_count
sign_in_as_user
user.reload

0 comments on commit e2793fc

Please sign in to comment.
Something went wrong with that request. Please try again.