我正在尝试在 rails 中构建一个生成器,但我在尝试访问现有模型的参数时遇到了困难。基本上我想做这样的事情:
# user is a model the has the parameters "id: integer, name: string, and email: string"
User.parameters.each do |parameter|
# do something with id, name, email
parameter.key
# do something with integer, string, string
parameter.value
end
有任何想法吗?