title: Rails: undefined method `model_name'?
body: <p>Getting a strange error when trying to output some data as a response to a json request. For the life of me I cannot figure out the problem here. I am doing something <em>very</em> similar in another controller and not getting any error at all. Any ideas what would be causing this? </p>
  
  <pre><code>  class SessionsController
    ...
    user = User.authenticate(params[:session][:email].downcase,
                             params[:session][:password].downcase)
    if user.nil?
      respond_with(@error = "Invalid email/password combination.")
    else
      sign_in user
      respond_with([user, user.authenticated_with])
    end
  
    -------------------------------------
  
    User.rb
    ...
    def authenticated_with
      fb_hash = {:facebook =&gt; (!self.authentications.where("provider = ?", "facebook").empty? ? true : false)}
      tw_hash = {:twitter =&gt; (!self.authentications.where("provider = ?", "twitter").empty? ? true : false)}
      providers = [fb_hash, tw_hash]
      return providers
    end
  
    -------------------------------------
  
    LOG OUTPUT
  
    2011-09-05T15:25:51+00:00 app[web.1]: NoMethodError (undefined method `model_name' for Array:Class):
    2011-09-05T15:25:51+00:00 app[web.1]:   app/controllers/sessions_controller.rb:24:in `create'
  </code></pre>
  
  <p>The log error is referencing this line:</p>
  
  <pre><code>  respond_with([user, user.authenticated_with])
  </code></pre>
  
  <p>Any ideas???</p>
  
  <p>Thanks!</p>