Re: Getting a foreign key value with @params

s002
Fri, 27 May 2005 16:10:35 -0000

For some reason this didn''t work.

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

But this did:

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

I don''t know why.  I''m still unclear on some the syntax
issues.
-Larry

Jarkko Laine wrote:

> 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
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>