diff --git a/Gemfile b/Gemfile index b60bc08..b5fbf94 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ git_source(:github) do |repo_name| end -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 diff --git a/Gemfile.lock b/Gemfile.lock index fba81e1..813f681 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,11 +39,6 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) - autoprefixer-rails (6.7.7) - execjs - bootstrap-sass (3.3.6) - autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) builder (3.2.3) byebug (9.0.6) coffee-rails (4.2.1) @@ -85,7 +80,7 @@ GEM nio4r (2.0.0) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) - puma (3.8.1) + puma (3.8.2) rack (2.0.1) rack-test (0.6.3) rack (>= 1.0) @@ -159,7 +154,6 @@ PLATFORMS ruby DEPENDENCIES - bootstrap-sass (= 3.3.6) byebug coffee-rails (~> 4.2) jbuilder (~> 2.5) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 5b33d60..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 TrungNT - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Prime.rb b/Prime.rb deleted file mode 100644 index ec5826b..0000000 --- a/Prime.rb +++ /dev/null @@ -1,21 +0,0 @@ -def is_prime? n - if(n<=1) - false - elsif n==2 - true - else - (2..n/2).none?{|i| n%i==0} - end -end -def find_primes a,b,n - primes=[] - i=1 - (a..b).to_a.each{|x| primes<90) + self.errors.add :date, "So tuoi phai tu 7 den 90" + end + end + end +end \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb deleted file mode 100644 index 4554fd6..0000000 --- a/app/views/layouts/_header.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8fa04d0..e7b6925 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - <%= full_title yield :title %> + UserModel <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> @@ -9,10 +9,6 @@ - <%= render "layouts/header" %> -
- <%= yield %> -
- + <%= yield %> diff --git a/app/views/static_pages/help.html.erb b/app/views/static_pages/help.html.erb deleted file mode 100644 index 9fc5a5c..0000000 --- a/app/views/static_pages/help.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - - - - - <% provide(:title, "Help")%> - - - -

Help

-

- Get help on the Ruby on Rails Tutorial at the - Rails Tutorial help - page. - To get help on this sample app, see the - Ruby on Rails - Tutorial - book. -

- - \ No newline at end of file diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb deleted file mode 100644 index 858b404..0000000 --- a/app/views/static_pages/home.html.erb +++ /dev/null @@ -1,24 +0,0 @@ - - - - - <% provide :title, "Home" %> - - - -
-

Welcome to the Sample App

- -

- This is the home page for the - Ruby on Rails Tutorial - sample application. -

- - <%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %> -
- - <%= link_to image_tag("rails.png", alt: "Rails logo"), - 'http://rubyonrails.org/' %> - - diff --git a/config/application.rb b/config/application.rb index 93d771c..1d5fddf 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,7 +6,7 @@ # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -module Blog1 +module UserModel class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/environments/production.rb b/config/environments/production.rb index 62fa443..d8a9a78 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -54,7 +54,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "blog1_#{Rails.env}" + # config.active_job.queue_name_prefix = "UserModel_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index cab4dcb..27cc7e4 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_blog1_session' +Rails.application.config.session_store :cookie_store, key: '_UserModel_session' diff --git a/config/routes.rb b/config/routes.rb index a14b518..787824f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,3 @@ Rails.application.routes.draw do - get 'static_pages/home' - - get 'static_pages/help' - root 'static_pages#home' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end diff --git a/config/secrets.yml b/config/secrets.yml index 930f785..47c8a87 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -11,10 +11,10 @@ # if you're sharing your code publicly. development: - secret_key_base: 65d1c785ca1398b24cfb5f3a427d5e21531815993be4861a324b6400cdc52794c21fbf8f6fa072642ef141a3701a01b5b195678f82427d6d90fd356bf2c8c3b0 + secret_key_base: 714f5878bd79645d0966f8d59fb038c38a597d0adce3674e60480593cb5a232e6deffbabce6960c375853f3fd830f5d512373d356a1450d0fb83c54968fc6066 test: - secret_key_base: 7eb6c64bd00349e4b9471e4de609c2137cb95911a80eb76ebd27818deb94e542bf68bb07fd8ae8e7657897e24716c2ce2a46cd3b59e30dff497a4963c77b753d + secret_key_base: 5b264fe356f61f13a021017ece335feb13a026d3feb6869dbbd7f518ab2772dc0a6376276326629bb59c53f2c6cf00bf4fb8fc630ec6f63bea4778bebbfb48d5 # Do not keep production secrets in the repository, # instead read values from the environment. diff --git a/db/development.sqlite3 b/db/development.sqlite3 index e69de29..e41b196 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/db/migrate/20170315152727_create_users.rb b/db/migrate/20170315152727_create_users.rb new file mode 100644 index 0000000..bfdb995 --- /dev/null +++ b/db/migrate/20170315152727_create_users.rb @@ -0,0 +1,12 @@ +class CreateUsers < ActiveRecord::Migration[5.0] + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :phone + t.date :date + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..5b1079c --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,24 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20170315152727) do + + create_table "users", force: :cascade do |t| + t.string "name" + t.string "email" + t.string "phone" + t.integer "date" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb deleted file mode 100644 index e9a0692..0000000 --- a/test/controllers/static_pages_controller_test.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'test_helper' - -class StaticPagesControllerTest < ActionDispatch::IntegrationTest - test "should get home" do - get static_pages_home_url - assert_response :success - end - - test "should get help" do - get static_pages_help_url - assert_response :success - end - -end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..3d7ae18 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + email: MyString + phone: MyString + date: 1 + +two: + name: MyString + email: MyString + phone: MyString + date: 1 diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end