2006-12-27

Excluding column names from a listing

关键字: rails
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 代码
 
  1. def content_columns  
  2.     @content_columns ||= columns.reject { |c| c.primary || c.name =~   
  3. /(_id|_count)$/ || c.name == inheritance_column }  
  4. end  

And add the column names you want to exclude in the regex with _id and
_count.
评论
发表评论

您还没有登录,请登录后发表评论

sea gull
搜索本博客
存档
最新评论
评论排行榜