First argument in form cannot contain nil or be empty ror
<p>This is my first ror app.
I have main page: <code>home.html.erb</code>
I have form there.</p>

<pre><code>  &lt;%= form_for(@lead ,:html =&gt; {:class =&gt; 'check_form'}) do |f| %&gt;

      &lt;%= f.text_field :phone, placeholder: 'phone' %&gt;
    &lt;%= f.submit "Check car status", class: "btn btn-large btn-primary" %&gt;
  &lt;% end %&gt;
</code></pre>

<p>Backstory: a customer(I call him Lead can input his phone number and check status of his car  which is being repaired now.)</p>

<p>Right now this view <code>home.html.erb</code>is served by <code>static_pages_controller</code></p>

<pre><code> class StaticPagesController &lt; ApplicationController
  def home
  end

  def help
  end
  def about
  end
  def contact
  end
end
</code></pre>

<p>I have also <code>LeadsController</code></p>

<pre><code>class LeadsController &lt; ApplicationController
  #before_action :signed_in_user, only: [:index, :edit, :update]
  #before_action :correct_user,   only: [:edit, :update]
  before_action :admin_user,     only: [:index, :edit, :update, :destroy]


  def index
        @leads = Lead.paginate(page: params[:page])
  end

  def destroy
    Lead.find(params[:id]).destroy
    flash[:success] = "record deleted."
    redirect_to leads_url
  end

  def show
    @lead = Lead.find(params[:id])
  end
  def new
    @lead = Lead.new
  end
  def create
    @lead = Lead.new(lead_params)
    if @lead.save
      #sign_in @lead
      flash[:success] = "Request successfully created!"
      redirect_to @lead
    else
      render 'new'
    end
  end

  def edit
    @lead = Lead.find(params[:id])
  end

  def update
    @lead = Lead.find(params[:id])
    if @lead.update_attributes(status: params[:status])
      flash[:success] = "Information updated"
      redirect_to leads_url
    else
      render 'edit'
    end
  end



  private

    def lead_params
      params.require(:lead).permit(:name, :email, :phone, :car_type,
      :car_year, :car_manufacturer, :car_model, :photo1, :photo2, :coords )
    end

    # Before filters

    def signed_in_user
      unless signed_in?
        store_location
        redirect_to signin_url, notice: "Please sign in."
      end
    end

    def correct_user
      @lead = Lead.find(params[:id])
      redirect_to(root_url) unless current_user?(@user)
    end
    def admin_user
      redirect_to(root_url) unless current_user.admin?
    end

end
</code></pre>

<p>What I want to do when user inputs his phone number to find lead in database with the same phone number and show repair status to user.
But it generates an error:
<code>First argument in form cannot contain nil or be empty</code> 
So I got that <code>form_for(@lead..</code> here @lead is empty. 
But what should I do to get rid of this error.?</p>