Results 1 to 5 of 5
Aug 4, 2008, 07:26 #1
- Join Date
- Oct 2004
- Austin Texas
- 0 Post(s)
- 0 Thread(s)
Not getting the associated columns when using :join in find
I have a users table that has these columns
and a tweets table that has these
and I'm trying to do a custom join by using
@tweets = Tweet.find(:all, :joins => 'LEFT JOIN users ON users.twitter_id = tweets.twitter_id' )
however doing an @tweets.inspect shows that only columns in the tweets table are being returned? (so there are not columns from the users table in the result set)
Does anyone know why this is?
I originally tried
@tweets = Tweet.find_by_sql('SELECT * FROM tweets, users where tweets.twitter_id = users.twitter_id;' )
but that was doing the same thing.
I'm a bit confused, because I was certain the column/attributes from the users table should have been returned as attributes?