Displaying 1 result from an estimated 1 matches for "createdemos".
Did you mean:
createdaemon
2007 Mar 13
0
ActiveRecord: strange tree behavior???
...derstand the problem?
many thanx in advance,
siegi
FILE demo.rb:
---
class Demo < ActiveRecord::Base
acts_as_tree
def set_sub_tree(value)
self.value = value
self.save!
children.each { |child|
child.set_sub_tree(value)
}
end
end
FILE 001_create_demos.rb:
---
class CreateDemos < ActiveRecord::Migration
def self.up
create_table :demos do |t|
t.column "value", :integer
t.column "parent_id", :integer
end
end
def self.down
drop_table :demos
end
end
FILE demos.yml:
---
one:
id: 1
value: 0
two:
id: 2
value: 0
p...