gpt4 book ai didi

ruby-on-rails - M. Hartl 的 RoR 书中的练习

转载 作者:数据小太阳 更新时间:2023-10-29 07:20:22 24 4
gpt4 key购买 nike

我一直在关注 Ruby-on-Rails tutorial 中的练习由 M. Hartl 着。我已经完成了第 4 章中的所有练习,但仍停留在这一章上:

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.

谁能建议如何解决这个问题?在我解决这个问题之前,我不想继续下一章。

最佳答案

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'

关于ruby-on-rails - M. Hartl 的 RoR 书中的练习,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10723061/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com