Person.create(:name =>"Paul", :age =>15)
这就算是mass-assignment了,所以age是nil的,其后直接age =就不再是mass-assignment了。
require "路径/文件",或者load "路径/文件"。用require时可以不写.rb扩展名。ruby运行时会读取系统环境变量RUBYLIB,把自己的库的路径添加到RUBYLIB后require可以不写路径,ruby可以搜索到Person.create(:name =>"Paul", :age =>15)
这就算是mass-assignment了,所以age是nil的,其后直接age =就不再是mass-assignment了。
require "路径/文件",或者load "路径/文件"。用require时可以不写.rb扩展名。ruby运行时会读取系统环境变量RUBYLIB,把自己的库的路径添加到RUBYLIB后require可以不写路径,ruby可以搜索到