Skip to content

Commit

Permalink
fix playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Aug 14, 2023
1 parent 20848cc commit ee65525
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
end

if params[:playlist_id]
@resource = Playlist.find(params[:playlist_id])
@resource = Playlist.friendly.find(params[:playlist_id])
end

@comment = @resource.comments.create(body: params[:comment][:body], user: current_user)
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/playlists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ def index
end

def show
@playlist = current_user.playlists.friendly.find(params[:id])
if current_user
begin
@playlist = current_user.playlists.friendly.find(params[:id])
rescue ActiveRecord::RecordNotFound
nil
end
end

@playlist = Playlist.published.friendly.find(params[:id]) unless @playlist
@track = @playlist.tracks.first

metatags = {
Expand Down
2 changes: 2 additions & 0 deletions app/views/playlists/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
</div>


<!--
<div class="sm:text-xl text-sm container mx-auto px-4 my-4 flex flex-col space-y-4">
<div id="xx-5">
Expand Down Expand Up @@ -258,6 +259,7 @@
</div>
<div class="text-sm text-gray-700 dark:text-gray-300 flex space-x-2 items-center" data-phx-component="4" id="phx-F3VKxllRnAKzdlMC-4-0"> Todos los derechos reservados </div>
</div>
-->


<div class="sm:text-xl text-sm container mx-auto px-4 my-4 prose-lg">
Expand Down

0 comments on commit ee65525

Please sign in to comment.