Pål Bergström wrote: > I have a controller and model for both "products" and "baskets". I've > set up the belongs_to and has_many. When I'm in a third controller > "shop" I get an error when I try to get the "products" data via > "baskets". So asking for item.product.price gives an error. > > Can I have this kind of relation when I'm in a third controller, that > doesn't have a model itself?
Controllers have nothing to do with models, although best practices suggests having a controller per model. A controller has visibility into all your models if it needs to.. Please show us your relations that you wrote in your models and the controller code used to access them and then we may be better prepared to assist you ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---