开发者

Enumerate all fields of a model in Rails

开发者 https://www.devze.com 2023-04-01 17:19 出处:网络
Is there a way to enumerate each fiel开发者_开发知识库ds of a model with his information (column name, type...) ?

Is there a way to enumerate each fiel开发者_开发知识库ds of a model with his information (column name, type...) ?

Article model : content string title string


You're looking for the ActiveRecord helper columns_hash():

Article.columns_hash
0

精彩评论

暂无评论...
验证码 换一张
取 消