can u tell me online tutorial..???
On Mar 7, 10:55 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Mar 7, 4:39 pm, Tod Tod <rails-mailing-l...@andreas-s.net> wrote:
>
>
>
> > Logically this kind of chaining
> > Shop.find(2).category.find(10).shop_categories should collect and join
> > appropriate associations and return data only for shop 2.
>
> That''s not really how it works - once you do that find(10) you get a
> perfectly ordinary instance of Category (ie the stop_categories is
> just scoped to the category - not the shop.
>
> I'm not sure why you're doing this at all - why not Shop.find
> (2).shop_categories.find_by_category_id(10) (or
> find_all_by_category_id if you want all of them)
>
> Fred
>
>
>
>
>
> > Could any one give some clues? Or clarify this kind of relation. Maybe
> > there is another way to retrieve this single data?
>
> > Thanks,
> > Tod
> > --
> > Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---