On Sat, Feb 28, 2009 at 5:16 AM, Joe Canares < [email protected]> wrote:
> > Hi everyone! > > I'm new to ror, and i'm stuck with what might be kind of a beginners > problem. > > Here's a brief description of what i'm trying to do: > > I have two classes, lets say Class_a and Class_b, with their models > "having" several instances of Class_c (via has_many). As far as i > understand it, i have to put those lines in the model of Class_c: > > belongs_to :Class_a > belongs_to :Class_b > > When im trying to save an instance of Class_c (right after saving say > Class_b), im getting an "SQLite3::SQLException: SQL logic error or > missing database: INSERT INTO Class_c"-Error. Can this be caused by the > fact that there is noch Class_a_id? > > To make my point clear: Class_c should belong to Class_a OR Class_b. > While saving an instance of Class_c i only have either an instance of > Class_a OR Class_b to refer to. > > Is it possible to have many belongs_to relationships in one model? I'm > not seeing how to implement the "c belongs to a OR b", perhaps someone > can lighten things up for me. > > Thanks in advance, > JC Hi, Class_* do not represent valid model names in Rails in the default case. In any case, I would recommend reading AWDwR 3rd Edition if you're new to Rails. Good luck, -Conrad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

