I struggled with this for over an hour before emailing the group, and figured out the problem minutes afterward.
It turns out naming a model, Model is a bad idea. CarModel works much better. Chris On Sun, Sep 21, 2008 at 6:05 PM, Chris Petersen < [EMAIL PROTECTED]> wrote: > Hi All, > > I'm writing my first merb/datamapper app, and I'm struggling a little with > the associations. I have the following models: > > class Make > include DataMapper::Resource > > property :id, Integer, :key => true, :serial => true > property :name, String > > has n, :models > end > > class Model > include DataMapper::Resource > > property :id, Integer, :key => true, :serial => true > property :name, String > > belongs_to :make > has n, :cars > end > > class Car > include DataMapper::Resource > > property :id, Integer, :key => true, :serial => true > property :released_on, Date > property :year, Integer > > belongs_to :model > end > > I did: > > rake dm:db:automigrate > > Which gives me the expected results (the database is setup properly, and > the appropriate model_id and make_id columns are there). However, when I try > to visit http://localhost:4000/cars/new I get a stack too deep error, and > the stack trace shows an infinite loop on the following lines: > > /Library/Ruby/Gems/1.8/gems/dm-core-0.9.5/lib/dm-core/associations/many_to_one.rb:28:in > `model_association' > /Library/Ruby/Gems/1.8/gems/dm-core-0.9.5/lib/dm-core/associations/many_to_one.rb:17:in > `model' > > I am using Merb 0.9.7 and Datamapper 0.9.5, any help would be greatly > appreciated. > > Thanks in advance, > Chris > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
