Skip to content

Instantly share code, notes, and snippets.

@nathanscott
Created June 26, 2012 06:22
Show Gist options
  • Save nathanscott/2993722 to your computer and use it in GitHub Desktop.
Save nathanscott/2993722 to your computer and use it in GitHub Desktop.
# Get from form:
# params[:date]
# params[:categories]
def index
quote_requests_in_context
end
private
def quote_requests_in_context
base = QuoteRequest
if params[:date]
base = base.where(:date => params[:date])
end
if params[:categories]
base = base.includes(:sub_categories).where(:sub_categories => SubCategory.find(params[:categories]))
end
base.all
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment