I couldn't find an example at datamapper.org /docs for a parent child relationship.
After a little searching, I found the answer in the integration tests. Here is the example:
class Node
include DataMapper::Resource
def self.default_repository_name
ADAPTER
end
property :id, Integer, :serial => true
property :name, String
has n, :children, :class_name => 'Node', :child_key => [ :parent_id ]
belongs_to :parent, :class_name => 'Node', :child_key => [ :parent_id ]
end
Hope that helps someone else.
It looks more like a tree relationship then a parent/child relationship.
ReplyDelete"In a hierarchical data model, data is organized into a tree-like structure. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one parent."
ReplyDeletehttp://en.wikipedia.org/wiki/Hierarchical_model
This is very helpful, though I'm not too familiar with datamapper. I'm trying to see if it'll fit what I need.
ReplyDeleteCould this be expanded to the parent becomes,
has n, :children, :class_name => 'Node', :child_key => [:child_id]
has n, :parents, :class_name => 'Node', :child_key => [:parent_id ]
Something like that would work with activerecord, but, like I said I'm not too familiar.
Cheers
scott,
ReplyDeleteActually I believe the syntax you suggested is what I first tried, and did not work, and caused the searching.
DataMapper is still somewhat young, so check the integration tests referenced in the post for the most recent developments.
Ah, I figured it out.
ReplyDeleteI didn't write a spec for it, nor would it stop any nonsensical inbred relationships, but:
pastie.
Why not just use the dm-is-tree plugin?
ReplyDeletehttp://github.com/datamapper/dm-more/tree/master/dm-is-tree
This comment has been removed by the author.
ReplyDeleteWe need lie detector tests for all government law enforcement officers at the city level, county level, state-level and federal level lie detector test
ReplyDeleteBy being fully and completely who we are, we then attract relationships that reflect back to us the fullness of our creative being website.
ReplyDeletethey could have a perfectly happy marriage but want to add some spice or fun. After all, something doesn't need to be broken for it to get better https://relationadvisor.com/
ReplyDeleteIt’s very excellent information and more real facts to provided that post.Thank you for sharing this information. 2018 hostgator coupons
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWe Provide Our Customers With Latest and up-to-date Dumps Questions & Answers with 100% Exam Passing Guarantee. We Promise Exceptional Success in First Attempt. PSE-Endpoint exam dumps
ReplyDeleteThank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. Learn More
ReplyDeleteI just want to let you know that I just check out your site and I find it very interesting and informative.. Here
ReplyDeleteConsistently I go to my office I get myself vis-à-vis with a parent. 90% of the time it will be a mother. She will disclose to me in extraordinary detail what she considers (surmises) isn't right with her kid.Diono Radian RXT Car Seat Review
ReplyDeleteHi,Thanks for the information about this Really nice Post.
ReplyDeletefunny internet names:-
https://www.coolwifinames.xyz/2018/11/funny-internet-names.html
Good article. You can find dog ramp for bed
ReplyDeleteThe blog delineates how hard the author has taken a shot at this.
ReplyDeletehttp://www.fidelitydating.com/his-secret-obsession-hero-instinct-review
So it will be troublesome attempting to specify all the relationship issues and what causes them.his secret obsession reviews
ReplyDeleteYou must take action today to find your soul mate. You can meet your future Arab bride on the Internet for free.http://seksitreffit.cam
ReplyDeleteI really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!. como conquistar um homem
ReplyDeleteI Have Read Your Article its Amazing Thanks For Sharing Your Knowledge..
ReplyDeleteBest Bow Sight
Presently please recall this was a child who felt comfortable around the lanes, she was no blessed messenger of blamelessness. For as long as two years she had split away, put dread into her parents and strolled the avenues.If you don’t want your child to be bullied
ReplyDeleteHave you heard of the saying that says that "what goes for the duck is also good for the geese" meaning that somebody somewhere is also having a serious challenge in his or her own relationship.Relationship Advice
ReplyDeleteThis particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… Causas de la depresion
ReplyDeleteSpats are important just in light of the fact that all out outsiders turned sweethearts must change their desires.http://www.threesomesites.org/couples-seeking-men-top-5-threesome-dating-sites.html
ReplyDeleteOur endeavors to do this typically drives us rapidly to look at our own issues about limits, since taking on someone else's obligations brings us outside of where we want to be. adult friend finder
ReplyDeleteIt was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. infant
ReplyDeleteYou must learn how to accommodate his or her weaknesses, some men are very fond of pointing out other persons mistakes rather than their strength, this will only generate strife and compound your relationship problem. 유흥알바
ReplyDeleteThe feeling of being replaced or being betrayed is not easy to cope with and so the betrayed spouse or partner often walk out of the relationship. Sex Swings and Slings
ReplyDeleteNot a single second went without leaving me in utter surprise.free transsexual dating sites
ReplyDeleteAwesome and interesting article. Great things you've always shared with us. Thanks. Just continue composing this kind of post. https://singlescenedating.com/recon/
ReplyDeleteThis particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… preschool photographer
ReplyDelete. The free join makes it more user-friendly and simple, but if you look forward to finding more Milfs for cuckold dating, having an option to pay $ 99.95 for 12 months which make your cuckold experience perfect and nice. sexting websites
ReplyDeleteThere are many threesomes, meeting your friends who have the same interest.the 3somedatingonline.com is a private, happy, safe threesome dating website and you can enjoy a good times on the site. couple seeking unicorns
ReplyDeleteYour articles are inventive. I am looking forward to reading the plethora of articles that you have linked here. Thumbs up! mutual app
ReplyDeleteTry not to stress we will manage it quickly however we should take a gander at another point that messes relationship up. best sites to find a threesome
ReplyDeleteThanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. cdff dating
ReplyDeleteThanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. Gái Checkerviet
ReplyDelete
ReplyDeleteA round of applause for your mind blowing article. Much thanks to you. Fantastic.
hitachi 1.5 ton 3 star split inverter ac
I read this article, it is really informative one. Your way of writing and making things clear is very impressive. pls visit our website family law attorney Houston TX.Thanking you for such an informative article.
ReplyDeleteYour blog contains lots of valuable data. It is a factual and beneficial article for us.Domestic Violence Lawyer Dubai Thankful to you for sharing an article like this.
ReplyDeleteAt this time, if you can use good medicinal materials and ingredients to strengthen hormones,Divorce Dispute Solution in NSW will be able to retain your youth and enjoy masculine power.
ReplyDeleteLooking forward to reading more. Great article. Really thank you!
ReplyDeleteLove Tips for Couples
A divorce lawyer to an extent determines the outcome of your divorce. How to find the best divorce lawyer is not hard. Make sure that lawyer knows his onions and has bags of courtroom experience. https://www.bestdivorcelawyerdelhi.in/
ReplyDelete