Class: TransactionsController

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

Overview

This controller provides restful route handling for Transactions.

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 /transactions
GET /transactions.xml
GET /transactions.json


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

def index
  @transactions = Transaction.all

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

- (Object) show

Examples:

GET /transactions/1
GET /transactions/1.xml
GET /transactions/1.json  


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

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

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