Created
December 4, 2008 12:38
-
-
Save mytrile/31924 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <h1>Registration</h1> | |
| <%= error_messages_for :user %> | |
| <div id="stylized" class="myform"> | |
| <%= form_for(@user, :action => resource(:users)) do %> | |
| <label>Username | |
| <span class="small">At least 4 characters</span> | |
| </label> | |
| <%= text_field :login %> | |
| <label>Password | |
| <span class="small">At least 6 symbols</span> | |
| </label> | |
| <%= text_field :password %> | |
| <label>Confirm password | |
| <span class="small">Retype your password</span> | |
| </label> | |
| <%= text_field :password_confirmation %> | |
| <button type="submit">Register</button> | |
| <div class="spacer"></div> | |
| <% end =%> | |
| </div> |
This file contains hidden or 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
| validates_present :login | |
| validates_is_unique :login, :message => "Username is already taken !" |
This file contains hidden or 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
| def new | |
| only_provides :html | |
| @user = User.new | |
| display @user | |
| end | |
| def create(user) | |
| @user = User.new(user) | |
| if @user.save | |
| redirect resource(@user), :message => {:notice => "User was successfully created"} | |
| else | |
| render :new | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment