1. 程式人生 > >Excluding column names from a listing

Excluding column names from a listing

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.