ok - misunderstood this The solution is already given by Fred
On 7 Mrz., 19:01, Tod Tod <[email protected]> wrote: > Hi rainer54 > > Actually > > Shop.find(1).categories.find(10) and > Shop.find(1).categories.find(:first, :conditions => 'category_id = 10') > > are the different ways to retrieve same category record in association > with shop 1. > > But going further with association I need to retrieve records from > shop_categories, so doing this > > Shop.find(1).category.find(10).shop_categories > > returns two records associated to two shops and category #10 from > shop_categories. And no matter if I try Shop.find(1).... or > Shop.find(2)..... it gives me same results from shop_categories. > > I need to use Rails 2.1 but I don't think so that is some problem from > within Rails. > > Tod > > rainer54 wrote: > > Hi Tod > > > For finding the category 10 of shop 1, the following should work by > > using > > Activerecord associations > > > Shop.find(1).categories.find(10) > > or > > Shop.find(1).categories.find(:first, :conditions => 'category = 10') > > > rainer > > -- > Posted viahttp://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 [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 -~----------~----~----~----~------~----~------~--~---

