Forum: Ruby on Rails plz help to correct my query

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D81c1821bb5fd0bb179a331175751908?d=identicon&s=25 Venkat Eee (venkat_ruby)
on 2009-05-28 11:14
Hi,

I want to display both terminal_id and user_id. If i try to echo by
using p i.e
p @list
It is displaying only terminal_id. Please help me to correct my query.

@list = NetworkTerminal.find(:all,
:select => "network_terminals.terminal_id,timings.user_id",
:joins => "LEFT JOIN timings ON network_terminals.terminal_id =
timings.terminal_id",
:conditions => {:network_id => 'net343'}
)

Thanks,
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2009-05-28 19:31
Venkat Eee wrote:
> Hi,
>
> I want to display both terminal_id and user_id.
[...]

Where is user_id supposed to come from?  It's not clear from looking at
your query.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-28 20:46
(Received via mailing list)
On May 28, 10:14 am, Venkat Eee <rails-mailing-l...@andreas-s.net>
wrote:
> Hi,
>
> I want to display both terminal_id and user_id. If i try to echo by
> using p i.e
> p @list
> It is displaying only terminal_id. Please help me to correct my query.
>
You're going to have to do that your self - output foo.user_id and
foo.terminal_id for each foo in your list.

Fred
D81c1821bb5fd0bb179a331175751908?d=identicon&s=25 Venkat Eee (venkat_ruby)
on 2009-05-29 06:32
Marnen Laibow-Koser wrote:
> Venkat Eee wrote:
>> Hi,
>>
>> I want to display both terminal_id and user_id.
> [...]
>
> Where is user_id supposed to come from?  It's not clear from looking at
> your query.
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> marnen@marnen.org

Hi,
user_id is a field in timings table.
This topic is locked and can not be replied to.