Skip to content

Instantly share code, notes, and snippets.

@xpepper
Created February 25, 2013 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpepper/5032643 to your computer and use it in GitHub Desktop.
Save xpepper/5032643 to your computer and use it in GitHub Desktop.
def search(search_options)
name_regexp = search_options[:name_regexp] || ""
starting_date = search_options[:starting_date] || Date.today
ending_date = search_options[:ending_date] || Date.today
where(:name => /#{name_regexp}/, "efforts.date" => {'$gte' => Date.parse(starting_date)}, "efforts.date" => {'$lte' => Date.parse(ending_date)})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment