Yea, also you can't name a property :model either.

For your :id, you have:

property :id, Integer, :key => true, :serial => true

You could write this like so:

property :id, Serial



On Sep 21, 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
> visithttp://localhost:4000/cars/newI 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to