Skip to content

Commit

Permalink
product
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Nov 19, 2024
1 parent fe27fe7 commit 3386981
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def update
if @product.save
redirect_to user_product_path(current_user.username, @product), notice: 'Product was successfully updated.'
else
Rails.logger.error("AAA #{@product.errors.full_messages}")
# render :edit, status: 422
render "update"
end
Expand Down
12 changes: 9 additions & 3 deletions app/views/products/_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
}
%>
<% if ['vinyl', 'cassette'].include?(product.category) %>
<%= form.select :playlist_id, current_user.playlists.where(playlist_type: ['album', 'ep']).map{|o|
[o.title, o.id]
}, label: "Album" %>
<%= form.select :playlist_id,
Playlist.where(user_id: current_user.id)
.or(Playlist.where(label_id: current_user.id))
.where(playlist_type: ["album", "ep"])
.map{|o|
[o.title, o.id]
}, label: "Album"
%>
<% end %>
</div>

Expand Down

0 comments on commit 3386981

Please sign in to comment.