Displaying 1 result from an estimated 1 matches for "documentitem".
Did you mean:
documentated
2010 Mar 10
0
Rails ActiveRecord associations autosave option
...has_many :document_sections, :dependent => :destroy, :autosave => true
has_many :document_items, :through => :document_sections
end
class DocumentSection < ActiveRecord::Base
belongs_to :document
has_many :document_items, :dependent => :destroy, :autosave => true
end
class DocumentItem < ActiveRecord::Base
belongs_to :document_section
end
When I use irb console to do
d = Document.find_by_id(100)
d.title = ''1-comments''
s = d.document_sections.find_by_id(200)
s.title = ''2-comments''
i = s.document_items.find_by_id(10)
i.comments = ...