Use new "strong parameters" from rails4
This commit is contained in:
@@ -8,7 +8,7 @@ class PlaylistsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@playlist = current_user.playlists.build(params[:playlist])
|
||||
@playlist = current_user.playlists.build(playlist_params)
|
||||
if @playlist.save
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
@@ -22,10 +22,16 @@ class PlaylistsController < ApplicationController
|
||||
|
||||
def update
|
||||
@playlist = Playlist.find(params[:id])
|
||||
if @playlist.update_attributes params[:playlist]
|
||||
if @playlist.update_attributes playlist_params
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def playlist_params
|
||||
params.require(:playlist).permit(:name)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user