Hello
I just started using datamapper and it feels great improvement over
AR. I need to port some AR code which uses 'reflections' in
ActiveRecord to find out the associations between models dynamically.
I was wondering what's the equivalent in DM world.  I see
'DataMapper::Associations::Relationship' class but it doesn't tell me
what kind of relationship it is (belongs_to vs has n etc).
Specifically, given a model class, how would I find out how many
belong_to's it has? In AR world I was doing this:

<ModelClass>.reflections.values.select{|v| v.macro
== :belongs_to}.each {|r|
  ...
}

Any pointers in documentation and/or source code would be helpful.
thanks
--~--~---------~--~----~------------~-------~--~----~
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