how to refence to other table items


Since I am noob with ruby still I have question. This is my setup.

2 tables and their fields.

Users table

Well there is and it works fine. But thats not the thing what I am
asking here. You can think that loginname =
could be anything like loginname=jane

and I figured it out

<% @imitems.each do |imitem| %>
<% if == user.imitem_id %>
<%= imitem.grpname %>
<% end %>
<% end %>

also needed to add on models


has_many :imitems


belongs_to :user

I didn’t believe that and I even tested it myself. I put:

“puts request.env[‘REMOTE_USER’]” in my blogs_controller index action and checked it in Firefox on Windows XP

It returned nil.

I checked it on IE7 on WindowsXP

It returned nil.

I checked it on Firefox in Ubuntu.

It returned nil.