title: Display children's count on Parent show - Rails 4
body: <p>I have 3 classes, <code>Products</code>, <code>ProductDetails</code>, <code>ProductStatuses</code></p>
  
  <p>The first have the general data.</p>
  
  <p>The second the inventory/stock and details of the products.</p>
  
  <p>The third determines If a <code>ProductDetail</code> (Product serial) is available or not to sell.</p>
  
  <p>I want to display a products' count on stock in <code>Products</code> index (General View).</p>
  
  <p>The models are the followings:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
     has_many :product_details
  end
  
  class ProductDetail &lt; ActiveRecord::Base
     belongs_to :product, foreign_key: :product_id
     belongs_to :product_status, foreign_key: :status
  end
  
  class ProductStatus &lt; ActiveRecord::Base
     has_many :product_details
  end
  </code></pre>
  
  <p>The schema is:</p>
  
  <pre><code>create_table "product_details", force: :cascade do |t|
     t.integer  "product_id", limit: 4
     t.string   "serial",     limit: 255
     t.string   "comment",    limit: 255
     t.datetime "created_at",             null: false
     t.datetime "updated_at",             null: false
     t.integer  "status",     limit: 4
  end
  
  create_table "product_statuses", force: :cascade do |t|
     t.boolean  "available"
     t.string   "name",       limit: 255
     t.datetime "created_at",             null: false
     t.datetime "updated_at",             null: false
  end
  
  create_table "products", force: :cascade do |t|
     t.string   "name",       limit: 255
     t.datetime "created_at",             null: false
     t.datetime "updated_at",             null: false
     t.boolean  "published"
  end
  </code></pre>
  
  <p>I'm a beginner using rails.</p>
  
  <p>I don't have idea how to get a children count. It sounds like a common question but I could not find a answer for this.</p>
  
  <p>Need help :(</p>
  
  <p>Thanks</p>