Created
February 25, 2013 19:50
-
-
Save xpepper/5032643 to your computer and use it in GitHub Desktop.
search snippet for https://github.com/xpepper/tracco
This file contains 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
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