Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- db/migrate/[timestamp]_add_admin_to_users.rb
- class AddAdminToUsers < ActiveRecord::Migration
- def change
- add_column :users, :admin, :boolean, default: false
- #Start - Adding for gender and dob
- add_column :users, :date_of_birth, :datetime
- add_column :users, :is_female, :boolean, default: false
- #End - Adding for gender and dob
- end
- end
- class User < ActiveRecord::Base
- .
- .
- GENDER_TYPES = [ ["Male","0"], [ "Female","1" ] ]
- validates :is_female, presence: true, inclusion: { in: ["0","1"] }
- .
- .
- class UsersController < ApplicationController
- .
- .
- private
- def user_params
- params.require(:user).permit(:name, :email, :password,
- :password_confirmation, :is_female, :date_of_birth)
- end
- .
- .
- Started POST "/users" for 1.39.63.200 at 2014-10-30 12:26:54 +0000
- Processing by UsersController#create as HTML
- Parameters: {"utf8"=>"_", "authenticity_token"=>"X1CF1B0ds3fn6QbPE4HhD/AAHo9n6D5+e8oHwgyiU4wSzV3hdUeKCE1Mr3PHJKYx7GPhwmpksYVxS/QmqpwjuQ==", "user"=>{"name"=>"Kumar", "email"=>"test12@test.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "is_female"=>"1", "date_of_birth(1i)"=>"2017", "date_of_birth(2i)"=>"10", "date_of_birth(3i)"=>"30"}, "commit"=>"Create my account"}
- (0.1ms) begin transaction
- User Exists (0.3ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('test12@test.com') LIMIT 1
- (0.1ms) rollback transaction
- Rendered shared/_error_messages.html.erb (0.7ms)
- Rendered users/new.html.erb within layouts/application (8.0ms)
- Rendered layouts/_shim.html.erb (0.1ms)
- Rendered layouts/_header.html.erb (0.6ms)
- Rendered layouts/_footer.html.erb (0.3ms)
- Completed 200 OK in 681ms (Views: 571.3ms | ActiveRecord: 1.5ms)
- 1.39.63.200 - - [30/Oct/2014:12:26:55 +0000] "POST /users HTTP/1.1" 200 - 0.7922
- --- !ruby/hash:ActionController::Parameters
- utf8: "✓"
- authenticity_token: X1CF1B0ds3fn6QbPE4HhD/AAHo9n6D5+e8oHwgyiU4wSzV3hdUeKCE1Mr3PHJKYx7GPhwmpksYVxS/QmqpwjuQ==
- user: !ruby/hash:ActionController::Parameters
- name: Kumar
- email: test12@test.com
- password: testtest
- password_confirmation: testtest
- is_female: '1'
- date_of_birth(1i): '2017'
- date_of_birth(2i): '10'
- date_of_birth(3i): '30'
- commit: Create my account
- controller: users
- action: create
- The form contains 1 error.
- Is female is not included in the list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement