title: ruby operationin where method
body: <p>I have this code so what I am trying to do is if I typed the first name or the last name in the search it will result any of first or last</p>
  
  <pre><code>   def self.search_by(search_term)
             where(["LOWER(first_name) LIKE :search_term", 
                    {search_term: "%#{search_term.downcase}%" } ]
                  ) || where(["LOWER(last_name) LIKE :search_term", 
                    {search_term: "%#{search_term.downcase}%" } ]
     end
  
  
  &lt;%= form_for "", url: members_path, class: "navbar-form navbar-left", role: "search", method: :get do %&gt;
              &lt;div id="tfheader"&gt;
                &lt;%= text_field_tag :search, @search_term  ,id: "search",class: "tftextinput", size: "21", maxlength: "120" %&gt;
                &lt;input type="submit" value="Search" class="tfbutton"&gt;
                &lt;div class="tfclear"&gt;&lt;/div&gt;
              &lt;/div&gt;
            &lt;% end %&gt;
  </code></pre>
  
  <p>Ex:</p>
  
  <ul>
  <li>First_name    Last_name</li>
  <li>John          Smeth</li>
  <li>Salma         Hayek</li>
  </ul>
  
  <p>if I type in the text area john it will give me the whole row or if I typed hayek it also give me the whole row</p>