class Api::V

Public Instance Methods

index() click to toggle source
# File lib/generators/api_controller/templates/api_controller.rb, line 6
def index
  @<%= model %> = <%= model.classify %>.all

  respond_to do |format|
    format.xml {render :xml => @<%= model %>}
    format.json {render :json => @<%= model %>}
  end
end

# GET /api/v<%= version %>/<%= model %>/1
# GET /api/v<%= version %>/<%= model %>/1.xml
# GET /api/v<%= version %>/<%= model %>/1.json
def show
  @<%= model.singularize %> = <%= model.classify %>.find(params[:id])

  respond_to do |format|
    format.xml {render :xml => @<%= model.singularize %>}
    format.json {render :json => 
show() click to toggle source

GET /api/v<%= version %>/<%= model %>/1.xml GET /api/v<%= version %>/<%= model %>/1.json

# File lib/generators/api_controller/templates/api_controller.rb, line 18
def show
  @<%= model.singularize %> = <%= model.classify %>.find(params[:id])

  respond_to do |format|
    format.xml {render :xml => @<%= model.singularize %>}
    format.json {render :json => @<