Skip to content

Commit

Permalink
fix: error on author name update
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek committed Aug 23, 2020
1 parent 2bba79f commit 6038f4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def edit
book.update(author_id: assigned_author.id)
end

if book.author_id
if book.author_id && removed_author
if removed_author.books.length === 0
removed_author.destroy()
end
Expand Down

0 comments on commit 6038f4e

Please sign in to comment.