:joins help

Dear all

@policy_logs = PolicyLog.find(:all,:joins => “INNER JOIN po
licy_logs_receiver”

                                 )

when i inspect the @policy_logs variable it doesnot show the joined
table fields…

how can i get all the fields?
Thanks for nay help

On Mar 8, 10:30 am, Newb N. [email protected] wrote:

Dear all

@policy_logs = PolicyLog.find(:all,:joins => “INNER JOIN po
licy_logs_receiver”

                                 )

when i inspect the @policy_logs variable it doesnot show the joined
table fields…

the select clause is select policy_logs.* by default. In addition the
output of inspect() (which is what you see in the console) only ever
shows the columns from the table itself.

Fred

Thanks for the reply…
Then how can i get associated field also…

On Mar 8, 11:41 am, Newb N. [email protected] wrote:

Thanks for the reply…
Then how can i get associated field also…

It’s just the output of inspect that is limited - every else works
fine (provided you change the select clause via the :select option)

Fred

Does Using :joins => “” requires association between the tables line
belongs_to ,hasmany like that …?

On Mar 9, 11:13 am, Newb N. [email protected] wrote:

Does Using :joins => “” requires association between the tables line
belongs_to ,hasmany like that …?

only if you want to use the shorthand form ( eg
Person.find :all, :join => :orders)

Fred

Thanks for the reply…
after only associating i got the associated table fields.

kindly look the below code

@policy_logs = PolicyLog.find(:all,
:joins =>" join policy_logs_receiver as plr on policy_logs.id =
plr.policy_logs_id")

Just in case… you know :include don’t you?