Class: AccountsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/accounts_controller.rb

Overview

This controller provides restful route handling for Accounts.

The controller supports ActiveResource, and provides for HMTL, XML, and JSON presentation.

Security:

Only GET requests are supported. You should ensure that your application controller enforces its own authentication and authorization, which this controller will inherit.

Author:

Instance Method Summary (collapse)

Instance Method Details

- (Object) index

Examples:

GET /accounts
GET /accounts.xml
GET /accounts.json


19
20
21
22
23
24
25
26
27
# File 'app/controllers/accounts_controller.rb', line 19

def index
  @accounts = .all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @accounts }
    format.json  { render :json => @accounts }
  end
end

- (Object) show

Examples:

GET /accounts/1
GET /accounts/1.xml
GET /accounts/1.json


33
34
35
36
37
38
39
40
41
# File 'app/controllers/accounts_controller.rb', line 33

def show
  @account = .find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @account }
    format.json  { render :json => @account }
  end
end