Skip to content

Instantly share code, notes, and snippets.

@kke
Created September 30, 2013 07:53
Show Gist options
  • Select an option

  • Save kke/6760592 to your computer and use it in GitHub Desktop.

Select an option

Save kke/6760592 to your computer and use it in GitHub Desktop.
cleaner way for this?
@actions = Action
@actions = @actions.where("created_at >= ?", params[:start_time]) if params[:start_time].present?
@actions = @actions.where("created_at <= ?", params[:end_time]) if params[:end_time].present?
@actions = @actions.where(user_id: params[:user_id]) if params[:user_id].present?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment