title: Ror find record in db and show it to user
body: <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
     @lead = Lead.new()
    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
  *some code*
  
    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
  
  * some code
  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.</p>
  
  <p>So back to my problem:
  I know how to find lead by phone like this <code>Lead.find(params[:id])</code>
  But where to write this code? I need to find lead by phone and then print it to screen. How can I do this?</p>