adds first name and last name to users
This commit is contained in:
9
app/controllers/registrations_controller.rb
Normal file
9
app/controllers/registrations_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def sign_up_params
|
||||||
|
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -3,9 +3,20 @@
|
|||||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||||
<%= devise_error_messages! %>
|
<%= devise_error_messages! %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :first_name %><br />
|
||||||
|
<%= f.text_field :first_name, autofocus: true %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :last_name %><br />
|
||||||
|
<%= f.text_field :last_name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :email %><br />
|
<%= f.label :email %><br />
|
||||||
<%= f.email_field :email, autofocus: true %>
|
<%= f.email_field :email %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :users
|
devise_for :users, :controllers => { registrations: 'registrations' }
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddFirstNameAndLastNameToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :first_name, :string
|
||||||
|
add_column :users, :last_name, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150716174358) do
|
ActiveRecord::Schema.define(version: 20150717164054) do
|
||||||
|
|
||||||
create_table "debates", force: :cascade do |t|
|
create_table "debates", force: :cascade do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
@@ -34,6 +34,8 @@ ActiveRecord::Schema.define(version: 20150716174358) do
|
|||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.string "first_name"
|
||||||
|
t.string "last_name"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
||||||
|
|||||||
Reference in New Issue
Block a user