Created
December 16, 2012 21:07
-
-
Save svs/4313089 to your computer and use it in GitHub Desktop.
params example 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooController < ApplicationController | |
def index | |
search_params = (params[:quotation] || {}).select{|k,v| !v.blank?} | |
q = search_params.delete("user") | |
if q | |
q = "%#{q}%" | |
search_params[:intended_trip] = {:user => {:conditions => ['email ilike ? or first_name ilike ? or last_name ilike ? or mobile_number ilike ?', q, q, q, q]}} | |
end | |
if params[:all] | |
@quotations = Quotation.all(search_params) | |
else | |
@quotations = Quotation.active(search_params) | |
end | |
if (params[:quotation][:workflow_state] rescue nil) == "callback" | |
@quotation_ids = @quotations.all(:workflow_state => "callback", :order => :callback_at.desc).aggregate(:id) | |
@poolability_scores = PoolabilityScore.all(:quotation_id => @quotations_ids).page(params[:page]) | |
@count = @quotation_ids.count | |
else | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment