Implement track/index action for API
This commit is contained in:
5
app/controllers/api/tracks_controller.rb
Normal file
5
app/controllers/api/tracks_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Api::TracksController < Api::ApplicationController
|
||||
def index
|
||||
@tracks = Track.all
|
||||
end
|
||||
end
|
6
app/views/api/tracks/index.rabl
Normal file
6
app/views/api/tracks/index.rabl
Normal file
@@ -0,0 +1,6 @@
|
||||
collection @tracks
|
||||
|
||||
attribute :id
|
||||
attribute :name
|
||||
|
||||
node(:sound_url, :if => ->(t) { t.sound? }) { |t| api_sound_url t.sound }
|
Reference in New Issue
Block a user