0
Как я могу удалить отношения has_one
с фиксацией в базу данных?Rails remove has_one без сохранения
class Foo
has_one :bar
validates :bar, presence: true
end
class Bar
belongs_to :foo
validates :foo, presence: true
end
foo = Foo.new
foo.build_bar
foo.save # => success
foo.bar = nil # => Failed to remove the existing associated bar. The record failed to save after its foreign key was set to nil.
Я искал какое-то время в Интернете и не нашел хорошего ответа. не