VRFS-22. List genres REST call.
This commit is contained in:
parent
2cefa2c669
commit
072be0062f
|
|
@ -25,3 +25,4 @@ doc/
|
|||
Gemfile.lock
|
||||
.sass-cache
|
||||
log/development.log.age
|
||||
log/test.log.age
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object @genres
|
||||
|
||||
extends "api_genres/show"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object @genre
|
||||
|
||||
attributes :id, :description
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in New Issue