如果我做:
name_array = Model.column_names
name_array.delete_if {|name| ["id","created_at","updated_at"].include?(name)}
pp Model.column_names
该命令将返回一个没有, &列名Model.column_names
的数组。我的假设是删除名称而不是 Model.column_names 数组。id
created_at
updated_at
name_array
导轨 3.0.13 红宝石 1.9.3