I've been following the exercises in the Ruby-on-Rails tutorial by M. Hartl. I have completed all the exercises in chapter 4 but am stuck on this one:
Create three hashes called
person1
,person2
, andperson3
, with first and last names under the keys:first
and:last
. Then create aparams
hash so thatparams[:father]
isperson1
,params[:mother]
isperson2
, andparams[:child]
isperson3
. Verify that, for example,params[:father][:first]
has the right value.
Can anyone suggest how to approach this problem? I don't want to proceed to next chapter until I have solved this.
person1 = {:first => 'Al', :last => 'Bundy'}
person2 = {:first => 'Peggy', :last => 'Bundy'}
person3 = {:first => 'Kelly', :last => 'Bundy'}
params = {
:father => person1,
:mother => person2,
:child => person3
}
params[:father][:first] #=> 'Al'
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