diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 28d3c89..3ec7882 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -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 diff --git a/app/views/products/_form.erb b/app/views/products/_form.erb index 9299882..a3f6722 100644 --- a/app/views/products/_form.erb +++ b/app/views/products/_form.erb @@ -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 %>