Created
July 12, 2010 15:49
-
-
Save ernie/472625 to your computer and use it in GitHub Desktop.
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
ruby-1.9.2-head > params = {:search => {:created_at_gteq => 2.weeks.ago}} | |
=> {:search=>{:created_at_gteq=>Mon, 28 Jun 2010 11:46:34 EDT -04:00}} | |
ruby-1.9.2-head > @search = Article.search(params[:search]) | |
=> #<MetaSearch::Builder:0x00000100ac2820 @relation=[], @base=Article(id: integer, title: string, body: text, created_at: datetime, updated_at: datetime, lookup_id: integer), @opts={}, @join_dependency=#<ActiveRecord::Associations::ClassMethods::JoinDependency:0x00000100ac25c8 @joins=[#<ActiveRecord::Associations::ClassMethods::JoinDependency::JoinBase:0x00000100ac25a0 @active_record=Article(id: integer, title: string, body: text, created_at: datetime, updated_at: datetime, lookup_id: integer), @cached_record={}, @table_joins=nil>], @associations=[], @reflections=[], @base_records_hash={}, @base_records_in_order=[], @table_aliases={"articles"=>1}>, @search_attributes={"created_at_greater_than_or_equal_to"=>Mon, 28 Jun 2010 11:46:34 EDT -04:00}> | |
ruby-1.9.2-head > @search.created_at_lteq ||= @search.created_at_gteq + 1.week | |
=> Mon, 05 Jul 2010 11:46:34 EDT -04:00 | |
ruby-1.9.2-head > @search.to_sql | |
=> "SELECT \"articles\".* FROM \"articles\" WHERE (\"articles\".\"created_at\" >= '2010-06-28 15:46:34.266412') AND (\"articles\".\"created_at\" <= '2010-07-05 15:46:34.266412')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment