Remove object from has_many but don't delete the original record in Rails? Remove object from has_many but don't delete the original record in Rails? ruby-on-rails ruby-on-rails

Remove object from has_many but don't delete the original record in Rails?


You should not use the delete method on the Paragraphobject, but instead use the delete method of paragraphs relation, like this:

post.paragraphs.delete(Paragraph.find(paragraph_id))