Rails: Unknown column in SELECT statement
<p>I'm trying to verify user login on a Rails app. The controller code looks like:</p>

<pre><code>def create
  user = User.where(params[:session][:email]).first
  # user = User.where(:type=&gt; 'User', :email =&gt; params[:session][:email])
  debugger
  if user and user.authenticate(params[:session][:password])
    session[:user_id] = user.id
    redirect_to admin_url
  else
    redirect_to login_url, alert: "Invalid user/password combination"
  end
end
</code></pre>

<p>Parameters are being correctly passed, but it's trying to search for a 'users' attribute in the users table. There isn't a users attr. The <code>users</code> table looks like this:</p>

<pre><code>mysql&gt; DESCRIBE users;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| userid     | int(11)      | YES  |     | NULL    |                |
| email      | varchar(255) | YES  |     | NULL    |                |
| password   | varchar(255) | YES  |     | NULL    |                |
| fname      | varchar(255) | YES  |     | NULL    |                |
| lname      | varchar(255) | YES  |     | NULL    |                |
| created_at | datetime     | NO   |     | NULL    |                |
| updated_at | datetime     | NO   |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
</code></pre>