Implement playlists/create action for API
This commit is contained in:
@@ -4,4 +4,9 @@ class Api::PlaylistsController < Api::ApplicationController
|
||||
def index
|
||||
@playlists = Playlist.all
|
||||
end
|
||||
|
||||
def create
|
||||
@playlist = current_user.playlists.build(params[:playlist].slice(:name))
|
||||
@playlist.save
|
||||
end
|
||||
end
|
||||
|
4
app/views/api/playlists/create.rabl
Normal file
4
app/views/api/playlists/create.rabl
Normal file
@@ -0,0 +1,4 @@
|
||||
object @playlist
|
||||
|
||||
attribute :id
|
||||
attribute :name
|
Reference in New Issue
Block a user