Displaying 1 result from an estimated 1 matches for "my_top_level_fil".
Did you mean:
my_top_level_file
2007 Jul 05
0
act_as_tree, belongs_to and has_many foreign keys incorrect
Two models:
class Project << ActiveRecord::Base
has_many :files
end
class File << ActiveRecord::Base
has_one :project
acts_as_tree
end
Inside of the project model, when creating a new product, I want to
store the hierarchy of files within it.
If I do,
my_top_level_file = my_project_object.files.create(:file_name =>
''foo'');
my_top_level_file.children.create(:file_name => ''bar'')
When the data gets saved, the first row in the Files table gets the
new product_id value that is also inserted into the Projects table,
but the c...