データベースの完全性のために単純な統計を取得しようとしています。入力されていないフィールドに「null」または「」があることを考慮して、レコードごとにフィールドの総数のうちいくつのフィールドが入力されているかを知りたいです。
既存のコードは次のようになります。
<% if @products %>
<% total_attribute_count = Product.columns.size %>
<% @products do |product| -%>
<p><%= platform.name %></p>
<p>I would like to have here a number of attributes filled in, so I could calculate a percentage based on total_attribute_count</p>
<% end -%>
<% end %>