Exercise in RoR book by M. Hartl

ruby, ruby-on-rails

Solution

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'

Problem

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`, and `person3`, with first and last names under the keys `:first` and `:last`. Then create a `params` hash so that `params[:father]` is `person1`, `params[:mother]` is `person2`, and `params[:child]` is `person3`. 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.

Original source