Skip to content

Instantly share code, notes, and snippets.

@jgarlick
Created July 17, 2012 20:16
Show Gist options
  • Save jgarlick/3131749 to your computer and use it in GitHub Desktop.
Save jgarlick/3131749 to your computer and use it in GitHub Desktop.
class AccountsController < ApplicationController
def new
@account = Account.new
end
def create
@account = Account.new(params[:account])
if @account.save
redirect_to @account, notice: 'Account was successfully created.'
else
render action: "new"
end
end
def show
@account = Account.find(params[:id])
end
def edit
@account = Account.find(params[:id])
end
def update
@account = Account.find(params[:id])
if @account.update_attributes(params[:account])
redirect_to @account, notice: 'Account was successfully updated.'
else
render action: "edit"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment