As part of a form I have in view:
<%= form_for(@invitation, method: :post, url: addinvite_path) do |f| %>
...
<label for="email", title="email"></label>
<%= email_field_tag :email, nil, placeholder: 'Email', autocomplete: 'off', required: true %><br>
...
The invitations controller method that processes a submission of the form:
def create
@user = User.find(email: params[:email])
...
Submitting the form produces an error pointing to the @user line:
PG::UndefinedTable: ERROR: missing FROM-clause entry for table "id"
I'm not sure what causes this error. Placing the debugger before the @user line confirms there's a value for params[:email]. But also in the debugger if I enter User.find(email: params[:email]) it returns the above enter. What could be causing the error?
find_by.@user = User.find_by(email: params[:email])- Pavan