Rails - How can I display one nested attributes (Solved) <p>I have a new problem, I Create a web where I upload many images, using nested attributes and polymorphic table, in my index.html I want to show only one image, but I can't find how. But I'm new in rails. </p> <p>photography.rb</p> <pre><code>class Photography &lt; ActiveRecord::Base validates :title, :description, presence: true belongs_to :user has_many :images, as: :imageable, dependent: :destroy accepts_nested_attributes_for :images, :reject_if =&gt; lambda { |a| a[:img_str].blank? }, :allow_destroy =&gt; true end </code></pre> <p>image.rb</p> <pre><code>class Image &lt; ActiveRecord::Base belongs_to :imageable, polymorphic: true mount_uploader :img_str, AssetUploader end </code></pre> <p>index.html.erb</p> <pre><code>&lt;% for photo in @photo %&gt; &lt;%= link_to photo.title, photography_path(photo) %&gt; &lt;% photo.images.each do |images| %&gt; &lt;%= images.img_str %&gt; &lt;% end %&gt; &lt;% end %&gt; </code></pre> <p>With the for method I show all the image, try add .first, but says <code>undefined method first for 5:Fixnum.</code> I think that I have to create a helper method, but I not sure. Can anyone help me?. Thanks</p>