Created
April 24, 2013 13:33
-
-
Save TXDynamics/5452159 to your computer and use it in GitHub Desktop.
Code for soving data to a database
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
| # The create def is a default just like show so you must use it | |
| # And you would use it when handling the submission of forms created | |
| # inside of the Controller for users | |
| def create | |
| # This code is run on the submission of our create form | |
| @user = User.new(params[:user]) | |
| if @user.save | |
| # This code is executed on a valid save | |
| redirect_to @user | |
| else | |
| render 'new' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment