[Rails] Re: Q: find :include

2009-02-27 Thread Frederick Cheung
On 27 Feb 2009, at 11:26, rails.n...@gmail.com wrote: So I have class Post ActiveRecord::Base belongs_to :user end @posts = Post.find :all, :include=:user but when I look at my logs I see this: Post Load (2.4ms) SELECT * FROM `posts` User Load (0.2ms) SELECT *

[Rails] Re: Q: find :include

2009-02-27 Thread vimal
what exactly do you want to do??? for me it looks like you want all the posts for the particular user then it should be @posts = User.posts --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

[Rails] Re: Q: find :include

2009-02-27 Thread rails.n...@gmail.com
what exactly do you want to do??? I just didn't want to make a new query everytime i accessed a user of a post However, Fred is right http://www.akitaonrails.com/2008/5/26/rolling-with-rails-2-1-the-first-full-tutorial-part-2 So 2 queries is ok! :) thanks guys