adding the foreign key to the has_many in the model file did it. Thanks! Steve.
-- Steve Van Bruwaene International Teams Canada Special Projects [email protected] http://www.vanbruwaene.ca "Developing Resources that help IT Canada be More Effective in its Mission." IT Canada: 519-669-8844, 1 Union St., Elmira, ON, N3B 3J9 IT US: 847-429-0900, 411 West River Road, Elgin, IL 60123, USA On Thu, Jul 2, 2009 at 2:28 PM, kevinpfromnm <[email protected]> wrote: > > Not sure but it might be looking for a corresponding reverse > association. Try adding a matching has_many :addresses, :foreign_key > => ... in the folder model. > > On Jul 2, 12:09 pm, Steve Van Bruwaene <[email protected]> wrote: > > Thanks! > > > > the primary key part seems to work fine. > > > > The foreign key however is causing me grief. When I add this (belongs_to > > :folder, :foreign_key => "FolderID" in the Address model), and try to run > > the server, I get > > /Library/Ruby/Gems/1.8/gems/hobo-0.8.8/lib/hobo/model_router.rb:176:in > > `owner_routes': Hob routing error -- can't find reverse association for > > Address#folder (e.g. the :has_many that corresponds to a :belongs_to) > > (HoboError) > > > > (Folder is the parent table, and Address the sub-table) > > > > If I change it back to "belongs_to :folder" (ie. no foreign key > declared), > > the server starts just fine, but when I try to access the page, it > complains > > that the auto-generated foreign key is not present. > > > > In other words, hobo_migration understands the foreign_key attribute, but > > hobo runtime doesn't seem to. Am I missing something, or did I discover > a > > bug in hobo? > > > > Thanks! > > > > Steve. > > > > -- > > Steve Van Bruwaene > > International Teams Canada > > Special Projects > > [email protected]http://www.vanbruwaene.ca > > "Developing Resources that help IT Canada be More Effective in its > Mission." > > > > IT Canada: 519-669-8844, 1 Union St., Elmira, ON, N3B 3J9 > > IT US: 847-429-0900, 411 West River Road, Elgin, IL 60123, USA > > > > On Mon, Jun 29, 2009 at 3:46 PM, Bryan Larsen <[email protected] > >wrote: > > > > > > > > > The foreign keys are specified via your associations -- use the > > > :foreign_key option in your has_many, for instance. > > > > > To change the primary key, you can use the set_primary_key command > > > inside your fields do -- see the bottom of > > >http://cookbook.hobocentral.net/manual/hobofields/migration_generator > > > > > Bryan > > > > > Steve VanB wrote: > > > > I have live legacy tables that I'd like to access with Hobo. > > > > > > As such, I'd like to create models around them, but not modify them. > > > > One thing I need to do in the models, is specify what the the primary > > > > key and foreign keys are. How do I do this with Hobo models? > > > > > > Thanks! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
