In Rails, how do you remove the has-many association through a link while preserving previously related objects? Is there an ActiveRecord way to do this or do I need to write SQL?
Is it also possible for objects to remain friends after the relationship is gone? [<- lame joke attempt]
Found it myself. collections.delete and just make sure that dependents are not set to delete or destroy. For some reason, asking a question in public seems to lead to the fact that I get an answer after 10 minutes on my own.
-, , , 10 .
, , , , , -, / .
Class A < ActiveRecord::Base has_many :b end Class B < ActiveRecord::Base belongs_to :a end
Abdelete - removes an association
Abdestroy - removes the association of associated objects (b)
Source: https://habr.com/ru/post/1704507/More articles:Mocking Objects When Using MSTest - .netLinq to sql: properties of properties that may be null - c #use accented characters with the Quickbooks SDK - c #MSSQL - Divide a field into 3 fields - sqlIs there a better PureMVC alternative for flash projects? - flashHow to find the 3D coordinates of the projected rectangle? - geometryОтправить несколько дейтаграмм с помощью одного вызова send()? - socketsSQL Reporting Services 2005 - Как получить текущую дату как ReportParameter - sql-server-2005Get last record from database - dateDelete only from memory not from database - ruby-on-railsAll Articles