Permalink
Browse files

User model refinements

  • Loading branch information...
1 parent 28eb5ab commit 0876a3d42270516c02ec8532b4b19b453ede5bfe @Puskin committed Jun 3, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −0 app/models/user.rb
  2. +4 −0 db/migrate/20120603161225_add_index_to_users_email.rb
  3. +1 −1 db/schema.rb
View
1 app/models/user.rb
@@ -9,6 +9,7 @@ class User < ActiveRecord::Base
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false }
validates :password, length: { minimum: 6 }
+ before_save { |user| user.email = email.downcase }
before_save :create_remember_token
View
4 db/migrate/20120603161225_add_index_to_users_email.rb
@@ -0,0 +1,4 @@
+class AddIndexToUsersEmail < ActiveRecord::Migration
+ def change
+ end
+end
View
2 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120603153736) do
+ActiveRecord::Schema.define(:version => 20120603161225) do
create_table "users", :force => true do |t|
t.string "name"

0 comments on commit 0876a3d

Please sign in to comment.