public
Rubygem
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-core.git
Search Repo:
added support for ranges in query, like Model.all(:date => 
yesterday..tomorrow)
somebee (author)
Wed May 07 13:53:26 -0700 2008
commit  6cc58071331ded6b6f5d8a1cc5a04e4e653f683d
tree    f8793d74a14fbc80d5eadce657ce1f2287fc31c3
parent  5aa6314b6c588b25d19445002655e2cc41538a35
...
554
555
556
 
557
558
559
...
565
566
567
 
568
569
570
...
554
555
556
557
558
559
560
...
566
567
568
569
570
571
572
0
@@ -554,6 +554,7 @@
0
         def equality_operator(query, model_name, operator, property, qualify, value)
0
           case value
0
             when Array then "#{property_to_column_name(model_name, property, qualify)} IN ?"
0
+ when Range then "#{property_to_column_name(model_name, property, qualify)} BETWEEN ?"
0
             when NilClass then "#{property_to_column_name(model_name, property, qualify)} IS NULL"
0
             when DataMapper::Query then
0
               query.merge_sub_select_conditions(operator, property, value)
0
@@ -565,6 +566,7 @@
0
         def inequality_operator(query, model_name, operator, property, qualify, value)
0
           case value
0
             when Array then "#{property_to_column_name(model_name, property, qualify)} NOT IN ?"
0
+ when Range then "#{property_to_column_name(model_name, property, qualify)} NOT BETWEEN ?"
0
             when NilClass then "#{property_to_column_name(model_name, property, qualify)} IS NOT NULL"
0
             when DataMapper::Query then
0
               query.merge_sub_select_conditions(operator, property, value)

Comments

  • dkubb Thu May 08 21:39:14 -0700 2008

    Do you mind writing one or more specs for this new behavior?

  • somebee Mon May 19 17:19:39 -0700 2008

    The speccing for this should go in do/data_objects (it is there that Range is quoted / put into the query). But data_objects has very few specs, and none related to quoting. Should I add quoting-specs?