title: Error when trying to display errors with RubyOnRails
body: <p>I'm seeing error:</p>
  
  <blockquote>
    <p>"undefined method `errors' for nil:NilClass"</p>
  </blockquote>
  
  <p>trying to display errors when creating a new user with a form. I'm a beginner with RoR so I have no idea where the error could come from. Here is my code:</p>
  
  <p>users_controller.rb</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_action :set_current_user
  
    def create
      @user = User.create firstName: params[:firstName], lastName: params[:lastName], email: params[:email], password: params[:password]
      if @user
        @current_user = User.where(email: params[:email], password: params[:password]).first
        session[:user_id] = @current_user.id
        flash[:info] = "Vous etes maintenant connecte"
        redirect_to "/users/home"
      else
        render 'signup'
      end
    end
  
    private
  
    def set_current_user
      if session[:user_id]
        @current_user = User.find(session[:user_id])
      end
    end
  end
  </code></pre>
  
  <p>user.rb</p>
  
  <pre><code>class User &lt; ApplicationRecord
  
    validates :firstName, presence: {
      message: "Vous avez oublie quelque chose."
    }
  
    validates :lastName, presence: {
      message: "Vous avez oublie quelque chose."
    }
  
    validates :email, presence: {
      message: "Vous avez oublie quelque chose."
    }
  
    validates :password, presence: {
      message: "Vous avez oublie quelque chose."
    }
  
    validates :email, uniqueness: {
      message: "Cet adresse email est deja prise."
    }
  end
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>Rails.application.routes.draw do
    get 'users/home' =&gt; 'users#home'
    get 'users/login' =&gt; 'users#login'
    get 'users/signup'
    post 'users/login' =&gt; 'users#check'
    post 'users/signup' =&gt; 'users#create'
    delete 'users/login' =&gt; 'users#logout'
  end
  </code></pre>
  
  <p>signup.html.erb</p>
  
  <pre><code>&lt;%= form_tag "/users/signup", method: "post" do %&gt;
    &lt;input type="text" name="firstName" placeholder="First Name" /&gt;
    &lt;p&gt;&lt;%= @user.errors[:firstName].first %&gt;&lt;/p&gt;
    &lt;!-- More fields here --&gt;
    &lt;input type="submit" value="Confirmer" /&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I saw this error appear on StackOverflow before but none of the answers applied to my problem :/ Thanks in advance for reading this and taking the time to help me!</p>