Files
growstuff/app/controllers/accounts_controller.rb
2013-05-18 10:50:36 +10:00

47 lines
1.0 KiB
Ruby

class AccountsController < ApplicationController
load_and_authorize_resource
# GET /accounts
# GET /accounts.json
def index
@accounts = Account.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @accounts }
end
end
# GET /accounts/1
# GET /accounts/1.json
def show
@account = Account.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @account }
end
end
# GET /accounts/1/edit
def edit
@account = Account.find(params[:id])
end
# PUT /accounts/1
# PUT /accounts/1.json
def update
@account = Account.find(params[:id])
respond_to do |format|
if @account.update_attributes(params[:account])
format.html { redirect_to @account, notice: 'Account detail was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end
end