ActiveRecord joins issue

I have been trying to figure out how to fix a particular joins query to
pull back everything from the query in the joined tables, but for some
reason results only come back from either one table or the other.

Code:
p = Page.find(1, :joins => :page_translations, :conditions =>
['page_translations.page_id = ?', 1])

The above will back everything from the pages table but nothing from the
page_translations table.

Code:
p = PageTranslation.find(1, :joins => :page, :conditions =>
['page_translations.page_id = ?', 1])

The above will back everything from the page_translations table but
nothing from the pages table.

I am needing to pull everything back from both tables.

Thanks in advance for all the help!

I have been trying to figure out how to fix a particular joins query to
pull back everything from the query in the joined tables, but for some
reason results only come back from either one table or the other.

Code:
p = Page.find(1, :joins => :page_translations, :conditions =>
['page_translations.page_id = ?', 1])

The above will back everything from the pages table but nothing from the
page_translations table.

Code:
p = PageTranslation.find(1, :joins => :page, :conditions =>
['page_translations.page_id = ?', 1])

The above will back everything from the page_translations table but
nothing from the pages table.

I am needing to pull everything back from both tables.

Thanks in advance for all the help!

AR defaults the select clause to pages.* (in the first case) but you
can override it if you want. beware about having multiple columns with
the same name selected (eg id) as they will stomp on each other

Fred

Frederick Cheung wrote:

AR defaults the select clause to pages.* (in the first case) but you
can override it if you want. beware about having multiple columns with
the same name selected (eg id) as they will stomp on each other

Fred

@Fred, can you give me an example of doing this?

Frederick Cheung wrote:
> AR defaults the select clause to pages.* (in the first case) but you
> can override it if you want. beware about having multiple columns with
> the same name selected (eg id) as they will stomp on each other

> Fred

@Fred, can you give me an example of doing this?

:select => 'pages.*, page_translations.some_column'

Fred