Is it possible in Rails to add an association to an existing record without immediately committing this change to the database? E.g. if I have Post has_many :ta
To add to Isaac's answer, post.association(:tags).add_to_target(Tag.first) works for has_many relationships, but you can use post.association(:tag).replace(Tag.first, false) for has_one relationships. The second argument (false) tells it not to save; it will commit it to the database by default if you leave the argument empty.