Hi all,
I have this relationship in a Rails app
class Folder
has_many :elements
end
class Element
belongs_to :folder
end
My problem is this code doesn't work
element = Element.first
a_folder.elements << element
element.save!
a_folder.save!
, but this one works:
element.folder = a_folder
element.save!
Anyone can tell me why?
Thanks.