Home>
I want to achieve

I want to eliminate errors around the form.

problem

It worked fine in my local environment, but after deploying to heroku I started getting an error.
When I go to the signup page, I get "We're sorry, but something went wrong."
When I checked the log, it was as follows.
It seems that the form is not good, but I don't know what is wrong.

INFO-: [1cda6211-bd91-414a-a944-0c90c5dc8c31] Completed 500 Internal Server Error in 176ms (ActiveRecord: 42.3ms)
FATAL-: [1cda6211-bd91-414a-a944-0c90c5dc8c31]
FATAL-: [1cda6211-bd91-414a-a944-0c90c5dc8c31] ActionView :: Template :: Error (undefined method `last_name'for #<User: 0x00007f4bd0e41240>):
FATAL-: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 6:<% = form_for (@user) do | f |%>
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 7:<% = render'shared/error_messages'%>
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 8:<% = f.label: last_name, "Last name"%>
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 9:<% = f.text_field: last_name, class:'form-control'%>
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 10:
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 11:<% = f.label: first_name, "name"%>
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] 12:<% = f.text_field: first_name, class:'form-control'%>
FATAL-: [1cda6211-bd91-414a-a944-0c90c5dc8c31]
FATAL-: [1cda6211-bd91-414a-a944-0c90c5dc8c31] app/views/users/new.html.erb: 9: in `block in _app_views_users_new_html_erb__3434323429866559602_69981802564760'
app [web.1]: [1cda6211-bd91-414a-a944-0c90c5dc8c31] app/views/users/new.html.erb: 6: in `_app_views_users_new_html_erb__3434323429866559602_69981802564760'
Corresponding code
6<% = form_for (@user) do | f |%>
7<% = render'shared/error_messages'%>
8<% = f.label: last_name, "Last name"%>
9<% = f.text_field: last_name, class:'form-control'%>
Ten
11<% = f.label: first_name, "before"%>
12<% = f.text_field: first_name, class:'form-control'%>
13
14<% = f.label: email, "Email address"%>
15<% = f.email_field: email, class:'form-control'%>
16
17<% = f.label: tel, "phone number"%>
18<% = f.text_field: tel, class:'form-control'%>
19
20<% = f.label: password, "password"%>
21<% = f.password_field: password, class:'form-control'%>
twenty two
23<% = f.label: password_confirmation, "password confirmation"%>
24<% = f.password_field: password_confirmation, class:'form-control'%>
twenty five
26<% = f.submit "Registration", class: "signup_btn"%>
27<% end%>
users_controller.rb
  def new
    @user = User.new
  end
  def create
    @user = User.new (user_params)
    if @ user.save
      @ user.send_activation_email
      # UserMailer.account_activation (@user) .deliver_now
      flash [: info] = "Please check your email to activate your account."
      redirect_to root_url
    else else
      render "new"
    end
  end
  private
  def user_params
    params.require (: user) .permit (: last_name,: first_name,: email,: tel,: password,: password_confirmation)
  end