title: Why is this method undefined if it's an attribute of my model?
body: <p>I'm trying to access the field of a object.  Here is my code:</p>
  
  <pre><code>&lt;% if @statuses %&gt;
        &lt;% @statuses.each do |status| %&gt;
          &lt;div class="well"&gt;
            &lt;%= status.content %&gt;
            &lt;br&gt;&lt;/br&gt;
  
            &lt;%= user = User.find_by_profile_name(params[:id]) %&gt;
            &lt;br&gt;&lt;/br&gt;
  
            &lt;% @profile_user = User.find(status.tag_list).first %&gt;
            &lt;%= link_to @profile_user.profile_name, user_profile_path(@profile_user.profile_name) %&gt;
  
  
            &lt;br&gt;&lt;/br&gt;
            &lt;%= status.user.full_name %&gt;
            &lt;hr /&gt;
            &lt;%= link_to time_ago_in_words(status.created_at), status_path(status) %&gt; ago
          &lt;/div&gt;
        &lt;% end %&gt;
      &lt;% end%&gt;
  </code></pre>
  
  <p>at this line:</p>
  
  <pre><code>&lt;%= link_to @profile_user.profile_name, user_profile_path(@profile_user.profile_name) %&gt;
  </code></pre>
  
  <p>I get this error message:</p>
  
  <pre><code>undefined method `profile_name' for #&lt; Array:0x007fe265c40410&gt;
  </code></pre>
  
  <p>This is my user model:</p>
  
  <pre><code>class User &lt; ApplicationRecord
        rolify
        # Include default devise modules. Others available are:
        # :confirmable, :lockable, :timeoutable and :omniauthable
        devise :database_authenticatable, :registerable,
               :recoverable, :rememberable, :trackable, :validatable
  
      validates :first_name, presence: true
  
      validates :last_name, presence: true
  
      validates :profile_name, presence: true, uniqueness: true,
                                format: {
                                  with: /\A[a-zA-Z0-9_-]+\z/,
                                  message: 'Must be formatted correctly'
                                }
  
      has_many :statuses
  
        def full_name
          first_name + " " + last_name
        end
  
        def gravatar_url
          stripped_email = email.strip
          downcased_email =stripped_email.downcase
          hash = Digest::MD5.hexdigest(downcased_email)
  
          "http://gravatar.com/avatar/#{hash}"
        end
  
      end
  </code></pre>
  
  <p>Does anyone know what I'm doing wrong?</p>