On Mar 17, 9:37 am, tonypm <[email protected]> wrote: > Hi, > > I have looked around quite a bit, and haven't found any workable > solution to this. > > I am accessing an external/remote database from my rails app, in order > to update a categories table. > > I cannot change the table structure of the remote database. it has a > categories table with an id field but has a one to one relationship > with a descriptions table. > > The descriptions table has no primary key, only a categories_id. > > Setting up a one-to-one relationship in my model allows me to load the > description along with the category. But I need to be able to create > a new category and description and cannot find a way around creating > an ActiveRecord object without a primary key. > > Grateful for any suggestion of how to do this. I am wondering if I > can use sql from within the model, but not quite sure how this would > be done. > Could you just tell rails that categories_id is the primary key? If it's unique then that should be good enough (you'll probably have to be a little careful when creating rows in this table though, as you'll need to set categories_id each time)
Fred > Tony -- 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.

