Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modeling users #55

Merged
merged 1 commit into from
Mar 23, 2017

Conversation

NHNam96
Copy link

@NHNam96 NHNam96 commented Mar 23, 2017

No description provided.

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa file này

@@ -0,0 +1,3 @@
// Place all the styles related to the Users controller here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa file này

@@ -0,0 +1,2 @@
module UsersHelper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xóa file này

@@ -0,0 +1,10 @@
class User < ApplicationRecord
before_save {self.email = email.downcase}
validates :name, presence: true, length: {maximum: 50}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cách bên trên 1 dòng trắng

before_save {self.email = email.downcase}
validates :name, presence: true, length: {maximum: 50}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: {maximum: 255},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 +  validates :email, presence: true, length: {maximum: 255},
 +    format: {with: VALID_EMAIL_REGEX},
 +    uniqueness: {case_sensitive: false}
 +  validates :password, presence: true, length: {minimum: 6}

 +  has_secure_password

config/routes.rb Outdated
@@ -1,6 +1,9 @@
Rails.application.routes.draw do
get 'users/new'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dùng nháy kép đi nào :D

@dieunb dieunb merged commit 59d80de into hellovietnam93:20143034_Ngo_Hoang_Nam Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants