newb
March 8, 2010, 11:30am
1
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
newb
March 8, 2010, 12:34pm
2
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
newb
March 8, 2010, 12:41pm
3
Thanks for the reply…
Then how can i get associated field also…
newb
March 8, 2010, 12:55pm
4
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
newb
March 9, 2010, 12:13pm
5
Does Using :joins => “” requires association between the tables line
belongs_to ,hasmany like that …?
newb
March 9, 2010, 12:19pm
6
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
newb
March 9, 2010, 12:33pm
7
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")
newb
March 8, 2010, 1:07pm
8
Just in case… you know :include don’t you?