Skip to content

Instantly share code, notes, and snippets.

@TXDynamics
Created April 24, 2013 13:33
Show Gist options
  • Select an option

  • Save TXDynamics/5452159 to your computer and use it in GitHub Desktop.

Select an option

Save TXDynamics/5452159 to your computer and use it in GitHub Desktop.
Code for soving data to a database
# 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