Noob question about CASTING (yes, I know)

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?

On 9/12/07, Josh H. [email protected] 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs