title: Ruby on Rails: Organize big search method
body: <p>I have big search method in my model that corresponds to search proper Car.
  It looks like this:</p>
  
  <pre><code>def self.search(params) 
      cars = joins(:reservations).where.not("reservations.reception_time &lt;= ? AND reservations.return_time &gt;= ?", 
        params[:return_date], params[:handover_date])
      cars = joins(:car_class).where("car_classes.id= ?", params[:car_class])
      cars = cars_at_both_locations(params[:handover_location], params[:return_location])
      cars = params[:car_body_style] == [""] ? cars : joins(:car_configuration).
         where("car_configurations.body_style_id = ?", params[:car_body_style]) 
      cars = params[:car_fuel] == [""] ? cars : where(fuel: params[:car_fuel]) 
      cars = params[:car_transmission] == [""] ? cars : where(transmission: params[:car_transmission]) 
      cars = params [:car_seats] == [""] ? cars : car_seats(params[:car_seats])
      cars = Car.joins(:prices).where('prices.to_days &gt;= ?', 
        (Date.parse(params[:return_date]) - Date.parse(params[:handover_date])).to_i)
    end
  </code></pre>
  
  <p>It is very unreadable...
  Did anyone have any idea to refactor this method to be more readable?</p>