VRFS-22. List genres REST call.

This commit is contained in:
Jonathon Wilson 2012-10-25 09:08:55 -06:00
parent 2cefa2c669
commit 072be0062f
5 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ doc/
Gemfile.lock
.sass-cache
log/development.log.age
log/test.log.age

View File

@ -0,0 +1,19 @@
class ApiGenresController < ApplicationController
# have to be signed in currently to see this screen
before_filter :signed_in_user
#respond_to :json, :xml
respond_to :html
def index
@genres = Genre.find(:all)
end
def show
@genre = Genre.find(params[:id])
gon.genre_id = @genre.id
gon.description = @genre.description
end
end

View File

@ -0,0 +1,3 @@
object @genres
extends "api_genres/show"

View File

@ -0,0 +1,3 @@
object @genre
attributes :id, :description

View File

@ -33,6 +33,9 @@ SampleApp::Application.routes.draw do
match '/sessions' => 'api_music_sessions#index', :via => :get
match '/sessions' => 'api_music_sessions#create', :via => :post
# genres
match '/genres' => 'api_genres#index', :via => :get
# users
match '/users' => 'api_users#index', :via => :get
match '/users/:id' => 'api_users#show', :via => :get, :as => 'api_user_detail'