Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## controller
- def register
- @h1 = "Register"
- @user ||= User.new
- if request.post?
- if @user.save
- end
- end
- end
- ## view
- <%= error_messages_for 'user' %>
- <%= start_form_tag ({:action => :register}, {:method => "post"}) %>
- <table>
- <tr><td class="category">Username:</td><td><%= text_field('user','username') %></td></tr>
- <tr><td class="category">Password:</td><td><%= password_field('user','password') %></td></tr>
- <tr><td class="category">Password Confirm:</td><td><%= password_field('user','password_confirmation') %></td></tr>
- </table>
- <input type="submit" name="submit" value="Register" />
- <%= end_form_tag %>
- ## model
- class User < ActiveRecord::Base
- validates_presence_of :username, :password
- validates_confirmation_of :password
- end
Add Comment
Please, Sign In to add comment