Permalink
Browse files

Rewrite before_save callback

  • Loading branch information...
1 parent aa5475e commit cef99cf3d8ffb8bad3623990e7265d8c1828ffa4 @dskecse committed Mar 4, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/user.rb
View
@@ -1,7 +1,7 @@
class User < ActiveRecord::Base
VALID_EMAIL_REGEX = /\A[\w+\-.]+@([a-z\d\-]+\.?)+[^.]\.[a-z]+\z/i
- before_save { self.email = email.downcase }
+ before_save { email.downcase! }
validates :name, presence: true, length: { maximum: 50 }
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },

0 comments on commit cef99cf

Please sign in to comment.