Created
December 4, 2008 11:47
-
-
Save mytrile/31917 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
| This is the generated form. | |
| <form method="post" action="/users"> | |
| <label for="user_login">Login</label> | |
| <input type="text" class="text" value="" name="user[login]" id="user_login"> | |
| <label for="user_password">Password</label> | |
| <input type="text" class="text" value="" name="user[password]" id="user_password"/> | |
| <label for="user_password_confirmation">Confirm password</label> | |
| <input type="text" class="text" value="" name="user[password_confirmation]" id="user_password_confirmation"/> | |
| <input type="submit" value="Create" name="submit"/> | |
| </form> |
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
| <%= form_for(@user, :action => resource(:users)) do %> | |
| <%= text_field :login, :label => "Login" %> | |
| <%= text_field :password, :label => "Password" %> | |
| <%= text_field :password_confirmation, :label => "Confirm password" %> | |
| <%= submit "Create" %> | |
| <% end =%> |
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 | |
| message[:error] = "User failed to be created" | |
| render :new | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment