Refactor controllers

This commit is contained in:
Thibault Jouan
2015-05-02 00:24:30 +00:00
parent 6001cd2e79
commit 8b226998a4
8 changed files with 51 additions and 17 deletions

View File

@@ -1,11 +1,12 @@
module API
class PlaylistsController < ApplicationController
before_action :set_playlist, only: :show
def index
@playlists = Playlist.all
end
def show
@playlist = Playlist.find(params[:id])
end
def create
@@ -16,6 +17,10 @@ module API
private
def set_playlist
@playlist = Playlist.find(params[:id])
end
def playlist_params
params.require(:playlist).permit :name
end