I'm a super newbie in RoR. Right now I'm working on this interesting Rails for Zombies exercises. And I got stuck with some syntax questions...
My code to this is:
Weapon.where(:zombie => "Ash")
But it won't work. If instead I typed:
Weapon.find(1)
I passed (since the first weapon belongs to the zombie Ash anyway).
My question is, what's wrong with my answer with this .where() method?
Thanks in advance.
You should have nested the query as follows:
Weapon.where(:zombie => {:name => "Ash"})
That would give you the weapons that belong to the zombies whose names are 'Ash'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With