Sorry for the amount of time it's taken me to look at this again but I can confirm that changing the relationship name from CartItem to cart_item has solved this issue. The warnings still appear, but it appears to function correctly.
Thanks Dan for your help. Regards, Andrew. On May 4, 4:34 am, "Dan Kubb (dkubb)" <[email protected]> wrote: > Andrew, > > > Let me firstly say that I am a beginner at (J)Ruby / Rails / > > Datamapper so quite possibly this is my own fault. :-) > > One technique I've found that really helps is to try to reproduce the > problem on a smaller scale. Remove extra dependencies like the web > framework, and just try to write a stand-alone script, with a > simplified model, and see if you can get it working there. Once you > do, start adding things back in until the models begin to resemble > your original case, and see where things break. When you've got alot > of moving parts that you're just learning about it can sometimes be > difficult to narrow down where a problem is. > > I took your models, simplified them, and created a sample stand-alone > script that works on my end to get you started: > > http://pastie.org/943901 > > > Can you or anyone else see anything obvious I'm doing wrong? > > The only thing that was obvious was that the relationship names > weren't correct. DM expects the relationship names to be lower-cased/ > underscored versions of the class names.. so CartItem becomes > cart_item. If the relationship is a belongs_to or has(1) then it > should be singular, and if it's a has(n) relationship it should be > plural (in this case cart_items). > > -- > > Dan > (dkubb) > > -- > 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 > athttp://groups.google.com/group/datamapper?hl=en. -- 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.
