Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates to users controller, view, and routes
- Loading branch information
Showing
4 changed files
with
65 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
class UsersController < ApplicationController | ||
def new | ||
@user = User.new | ||
end | ||
|
||
def create | ||
@user = User.new(params[:user]) | ||
if @user.save | ||
redirect_to root_url, :notice => "Signed up!" | ||
else | ||
render "new" | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
<h1>Users#new</h1> | ||
<p>Find me in app/views/users/new.html.erb</p> | ||
<h1>Sign Up</h1> | ||
|
||
<%= form_for @user do |f| %> | ||
<% if @user.errors.any? %> | ||
<div class="error_messages"> | ||
<h2>Form is invalid</h2> | ||
<ul> | ||
<% for message in @user.errors.full_messages %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<p> | ||
<%= f.label :email %><br /> | ||
<%= f.text_field :email %> | ||
</p> | ||
<p> | ||
<%= f.label :password %><br /> | ||
<%= f.password_field :password %> | ||
</p> | ||
<p> | ||
<%= f.label :password_confirmation %><br /> | ||
<%= f.password_field :password_confirmation %> | ||
</p> | ||
<p class="button"><%= f.submit %></p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,6 @@ | ||
Auth::Application.routes.draw do | ||
get "users/new" | ||
|
||
# The priority is based upon order of creation: | ||
# first created -> highest priority. | ||
|
||
# Sample of regular route: | ||
# match 'products/:id' => 'catalog#view' | ||
# Keep in mind you can assign values other than :controller and :action | ||
|
||
# Sample of named route: | ||
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase | ||
# This route can be invoked with purchase_url(:id => product.id) | ||
|
||
# Sample resource route (maps HTTP verbs to controller actions automatically): | ||
# resources :products | ||
|
||
# Sample resource route with options: | ||
# resources :products do | ||
# member do | ||
# get 'short' | ||
# post 'toggle' | ||
# end | ||
# | ||
# collection do | ||
# get 'sold' | ||
# end | ||
# end | ||
|
||
# Sample resource route with sub-resources: | ||
# resources :products do | ||
# resources :comments, :sales | ||
# resource :seller | ||
# end | ||
|
||
# Sample resource route with more complex sub-resources | ||
# resources :products do | ||
# resources :comments | ||
# resources :sales do | ||
# get 'recent', :on => :collection | ||
# end | ||
# end | ||
|
||
# Sample resource route within a namespace: | ||
# namespace :admin do | ||
# # Directs /admin/products/* to Admin::ProductsController | ||
# # (app/controllers/admin/products_controller.rb) | ||
# resources :products | ||
# end | ||
|
||
# You can have the root of your site routed with "root" | ||
# just remember to delete public/index.html. | ||
# root :to => "welcome#index" | ||
|
||
# See how all your routes lay out with "rake routes" | ||
|
||
# This is a legacy wild controller route that's not recommended for RESTful applications. | ||
# Note: This route will make all actions in every controller accessible via GET requests. | ||
# match ':controller(/:action(/:id(.:format)))' | ||
end | ||
get "sign_up" => "users#new", :as => "sign_up" | ||
root :to => "users#new" | ||
|
||
resources :users | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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 to check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(:version => 20110619073157) do | ||
|
||
create_table "users", :force => true do |t| | ||
t.string "email" | ||
t.string "password_hash" | ||
t.string "password_salt" | ||
t.datetime "created_at" | ||
t.datetime "updated_at" | ||
end | ||
|
||
end |