-
Notifications
You must be signed in to change notification settings - Fork 22
usermodel #78
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
base: nguyen_van_hanh_20141418
Are you sure you want to change the base?
usermodel #78
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,54 @@ | ||
| source 'https://rubygems.org' | ||
| source "https://rubygems.org" | ||
|
|
||
| git_source(:github) do |repo_name| | ||
| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") | ||
| "https://github.com/#{repo_name}.git" | ||
| end | ||
|
|
||
|
|
||
| gem 'bootstrap-sass','3.3.6' | ||
| # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
| gem 'rails', '~> 5.0.2' | ||
| gem "bootstrap-sass","3.3.6" | ||
| # Bundle edge Rails instead: gem "rails", github: "rails/rails" | ||
| gem "rails", "~> 5.0.2" | ||
| # Use sqlite3 as the database for Active Record | ||
| gem 'sqlite3' | ||
| gem "sqlite3" | ||
| # Use Puma as the app server | ||
| gem 'puma', '~> 3.0' | ||
| gem "puma", "~> 3.0" | ||
| # Use SCSS for stylesheets | ||
| gem 'sass-rails', '~> 5.0' | ||
| gem "sass-rails", "~> 5.0" | ||
| # Use Uglifier as compressor for JavaScript assets | ||
| gem 'uglifier', '>= 1.3.0' | ||
| gem "uglifier", ">= 1.3.0" | ||
| # Use CoffeeScript for .coffee assets and views | ||
| gem 'coffee-rails', '~> 4.2' | ||
| gem "coffee-rails", "~> 4.2" | ||
| # See https://github.com/rails/execjs#readme for more supported runtimes | ||
| # gem 'therubyracer', platforms: :ruby | ||
| # gem "therubyracer", platforms: :ruby | ||
|
|
||
| # Use jquery as the JavaScript library | ||
| gem 'jquery-rails' | ||
| gem "jquery-rails" | ||
| # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks | ||
| gem 'turbolinks', '~> 5' | ||
| gem "turbolinks", "~> 5" | ||
| # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | ||
| gem 'jbuilder', '~> 2.5' | ||
| gem "jbuilder", "~> 2.5" | ||
| # Use Redis adapter to run Action Cable in production | ||
| # gem 'redis', '~> 3.0' | ||
| # gem "redis", "~> 3.0" | ||
| # Use ActiveModel has_secure_password | ||
| # gem 'bcrypt', '~> 3.1.7' | ||
| gem "bcrypt", "~> 3.1.7" | ||
|
|
||
| # Use Capistrano for deployment | ||
| # gem 'capistrano-rails', group: :development | ||
| # gem "capistrano-rails", group: :development | ||
|
|
||
| group :development, :test do | ||
| # Call 'byebug' anywhere in the code to stop execution and get a debugger console | ||
| gem 'byebug', platform: :mri | ||
| # Call "byebug" anywhere in the code to stop execution and get a debugger console | ||
| gem "byebug", platform: :mri | ||
| end | ||
|
|
||
| group :development do | ||
| # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. | ||
| gem 'web-console', '>= 3.3.0' | ||
| gem 'listen', '~> 3.0.5' | ||
| gem "web-console", ">= 3.3.0" | ||
| gem "listen", "~> 3.0.5" | ||
| # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | ||
| gem 'spring' | ||
| gem 'spring-watcher-listen', '~> 2.0.0' | ||
| gem "spring" | ||
| gem "spring-watcher-listen", "~> 2.0.0" | ||
| end | ||
|
|
||
| # Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
| gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] | ||
| gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| class UsersController < ApplicationController | ||
| def new | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| module ApplicationHelper | ||
| def full_title page_title='' | ||
| base_title="Ruby on Rails Tutorial Sample App" | ||
| def full_title page_title = "" | ||
| base_title = "Ruby on Rails Tutorial Sample App" | ||
| if page_title.empty? | ||
| base_title | ||
| else | ||
| page_title+ "|" +base_title | ||
| page_title + "|" + base_title | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| class ApplicationMailer < ActionMailer::Base | ||
| default from: 'from@example.com' | ||
| layout 'mailer' | ||
| default from: "from@example.com" | ||
| layout "mailer" | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| class User < ApplicationRecord | ||
| validates :name, presence: true | ||
| validates :email, presence:true | ||
| validates :phone, presence:true | ||
| validates :birthday, presence:true | ||
| validate :check_phone | ||
| validate :check_date | ||
| has_secure_password | ||
|
|
||
| private | ||
| def check_phone | ||
| if self.phone | ||
| if self.phone.length == 10 && self.phone[0] == "0" | ||
| else | ||
| self.errors.add :phone, "So dien thoai phai co 10 ky tu va khong bat dau boi 0" | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def check_date | ||
| if self.birthday | ||
| if (Time.now.year-birthday.year) < 7 || (Time.now.year-birthday.year) > 90 | ||
| self.errors.add :date, "So tuoi phai tu 7 den 90" | ||
| end | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| <header class="navbar navbar-fixed-top navbar-inverse"> | ||
| <div class="container"> | ||
| <%= link_to "sample app","#",id:"logo" %> | ||
| <nav> | ||
| <ul class="nav navbar-nav navbar-right"> | ||
| <li><%= link_to"Home","#" %></li> | ||
| <li><%= link_to"Help","#" %></li> | ||
| <li><%= link_to"Log in", "#" %></li> | ||
| </ul> | ||
| </nav> | ||
| </div> | ||
| </header> | ||
| <div class="container"> | ||
| <%= link_to "sample app","#",id:"logo" %> | ||
| <nav> | ||
| <ul class="nav navbar-nav navbar-right"> | ||
| <li><%= link_to"Home","#" %></li> | ||
| <li><%= link_to"Help","#" %></li> | ||
| <li><%= link_to"Log in", "#" %></li> | ||
| </ul> | ||
| </nav> | ||
| </div> | ||
| </header> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,16 +3,14 @@ | |
| <head> | ||
| <title><%= full_title yield :title %></title> | ||
| <%= csrf_meta_tags %> | ||
|
|
||
| <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
| <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> | ||
| <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track": "reload" %> | ||
| <%= javascript_include_tag "application", "data-turbolinks-track": "reload" %> | ||
| </head> | ||
|
|
||
| <body> | ||
| <%= render "layouts/header" %> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ident |
||
| <div class="container"> | ||
| <%= yield %> | ||
| </div> | ||
|
|
||
| <%= yield %> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <h1>Users#new</h1> | ||
| <p>Find me in app/views/users/new.html.erb</p> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ident check lại đi em ơi