[英]Rails: How do I find out what fields are in an active record
I've got an active record class open. 我有一个活跃的记录课开放。 I want to know all the fields available to me in that class?
我想知道那堂课中我可以使用的所有领域吗?
How can I do this quickly, without walking over to the database design document hanging on my wall? 如何快速完成此操作,而无需走到挂在墙上的数据库设计文档中?
I'm trying to wrap my head around having public data elements, obfuscated from me, but I just find it so frustrating to get at the field names available. 我正试图将公共数据元素包裹起来,对我进行模糊处理,但我发现获得字段名称非常令人沮丧。
也许Model.attribute_names
正是你要找的。
注释宝石非常适合这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.