Re: Getting a foreign key value with @params

Jarkko Laine
Thu, 26 May 2005 11:02:00 -0000

On 26.5.2005, at 13:49, s002 wrote:

> I''m sure this has a simple solution, but it''s puzzling to
me.
>
> I have a link that passed the id of a lookup key.   ( item.id) I want
> to retrieve the ''name'' column. This is what I tried.
>
> @value = subject.@params[:item.id].name
>
> But it does work.  What am I missing?

Let''s assume that what you''re dealing with is an object of
class Item.

value = Item.find(@params["item"]["id"]).name

//jarkko

>
> -Larry
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Jarkko Laine
http://jlaine.net
http://odesign.fi


_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org