There is an table that contains associations into itself.
An account are referred by another one through account_id (or
parent_id on dm-is-tree using) column.

Both dm-is-tree  and has/belong  methods returns same error on
children fetching.

---
class Account
  include DataMapper::Resource
  property( :id, Integer, :serial => true )
  belongs_to :account
  has n, :accounts
end
---

Hierarchy
id1
  +- id2
    +- id3

acc = Account.get(2)

now, i can fetch parent by
acc.account
it returns id1

but, when i try to fetch children, by
acc.accounts
get error:
undefined method `<<' for nil:NilClass
 /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:99:in `get_children'
  /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.9/lib/extlib/
lazy_array.rb:391:in `each'
  /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.9/lib/extlib/
lazy_array.rb:391:in `send'
...

tried dm-is-tree as well
---
class Account
  include DataMapper::Resource
  property( :id, Integer, :serial => true )
  is :tree
end
---
now, the relation column are parent_id
got same result
acc.parent  works
acc.children  returns same error
undefined method `<<' for nil:NilClass
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:99:in `get_children'
  /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.9/lib/extlib/
lazy_array.rb:391:in `each'
  /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.9/lib/extlib/
lazy_array.rb:391:in `send'
  /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.9/lib/extlib/
lazy_array.rb:391:in `method_missing'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
collection.rb:664:in `method_missing'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:95:in `get_children'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:172:in `with_repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/support/
kernel.rb:6:in `repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core.rb:
181:in `repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
repository.rb:44:in `scope'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core.rb:
181:in `repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/support/
kernel.rb:6:in `repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:172:in `with_repository'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/relationship.rb:80:in `get_children'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/one_to_many.rb:251:in `children'
  /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/
associations/one_to_many.rb:309:in `method_missing'


any suggestions pls?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to