Usually, it is better to make your own view instead of using the
scaffold, but sometimes it's easier just to use the scaffolding.
What I did was override the content_columns method. Just take the
source:
ruby 代码
- def content_columns
- @content_columns ||= columns.reject { |c| c.primary || c.name =~
- /(_id|_count)$/ || c.name == inheritance_column }
- end
And add the column names you want to exclude in the regex with _id and
_count.
本文介绍了一种在Ruby on Rails应用中定制视图的方法,通过覆盖默认的内容列展示方式来排除如_id和_count等后缀的字段,以此实现更灵活的数据展示。
1234

被折叠的 条评论
为什么被折叠?



