[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

noob question about CASTING (yes, I know

Josh Hester

9/12/2007 3:27:00 PM

ok, well i have os_hardware_combos.send("platform_id") which returns 1
and i have Platforms.find(1)
which returns a value i want
but if i do Platforms.find(os_hardware_combos.send("platform_id")) it says,
no id supplied to the find method

The only thing I can think of would be the 1 that is returned is not
numeric? Although this didn't seem very ruby like.

Any help?


1 Answer

Logan Capaldo

9/12/2007 4:30:00 PM

0

On 9/12/07, Josh Hester <josh.hester@sas.com> wrote:
> ok, well i have os_hardware_combos.send("platform_id") which returns 1
> and i have Platforms.find(1)
> which returns a value i want
> but if i do Platforms.find(os_hardware_combos.send("platform_id")) it says,
> no id supplied to the find method
>
> The only thing I can think of would be the 1 that is returned is not
> numeric? Although this didn't seem very ruby like.
>
This is really an activerecord question, but I'll give it a shot. You
should try doing it like
Platforms.find(:first, :id => os_hardware_combos.platform_id)

Actually, if os_hardward_combos is an instance of AR, you should just
do os_hardware_combos.platform

> Any help?
>
>
>
>