Skip to content

Commit

Permalink
updated the edit piece so that notes are included and persist properly
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewasmit committed Feb 20, 2023
1 parent 4b2f21c commit 21fd4c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class ApplicationController < Sinatra::Base
end

patch "/library/:id" do
# binding.pry
note = Note.create(note: params[:notes])
piece = Piece.find(params[:id])
piece.update(
reference_recording: params[:reference_recording],
Expand All @@ -40,6 +42,7 @@ class ApplicationController < Sinatra::Base
genre: params[:genre],
difficulty: params[:difficulty]
)
piece.connect_note_to_piece
piece.to_json(include: :notes)
end

Expand Down

0 comments on commit 21fd4c2

Please sign in to comment.