title: How to handle a collection of items when passing them to a helper?
body: <p>I have a helper that receives a group of attachments collection and tries to calculate if the images are square or not.</p>
  
  <p>On the views I have a condition like <code>suggestion_grid_square?(@attachments)</code> and the helper methods are.</p>
  
  <p>(I have simplified the code to make it clearer for the problem of this question)</p>
  
  <pre><code>  def suggestion_grid_square?(*attachments) 
      suggestion_column_squares?(1,attachments)
    end
  
    def attachment_square?(attachment)
      (attachment.file_height.to_f / attachment.file_width) &lt;= 1
    end
  
    private
  
    def suggestion_column_squares?(column,*attachments)
      attachments.each do |attachment|
        attachment_square?(attachment)
      end
    end
  </code></pre>
  
  <p>The following code is returning me this error: <code>undefined method file_height for #&lt;Array:0x007fa827e9af30&gt;</code></p>
  
  <p><code>
  app/helpers/suggestions_helper.rb:8:in `attachment_square?'
  app/helpers/suggestions_helper.rb:15:in `block in suggestion_column_squares?'
  </code></p>
  
  <p>Any idea why it is not receiving the <code>file_height</code> attribute or what Im doing wrong here?</p>
  
  <p><strong>Update</strong> this is how I create the collection and how I call the helper on views:</p>
  
  <pre><code>boutique_products = Product.by_most_recent.sold_or_designed_by(boutique).shuffle.first(4)
  boutique_products.each { |product| (@attachments &lt;&lt; product.default_attachment_or_first_attachment) } 
  
  .follow-boutique-grid{class: ("square-suggestion-grid" if suggestion_grid_square?(@attachments)) }
  </code></pre>