incubator-alois-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fla...@apache.org
Subject svn commit: r1040565 - /incubator/alois/trunk/rails/app/models/date_condition.rb
Date Tue, 30 Nov 2010 15:05:27 GMT
Author: flavio
Date: Tue Nov 30 15:05:26 2010
New Revision: 1040565

URL: http://svn.apache.org/viewvc?rev=1040565&view=rev
Log:
Quote date in date conditions based on connection class

Modified:
    incubator/alois/trunk/rails/app/models/date_condition.rb

Modified: incubator/alois/trunk/rails/app/models/date_condition.rb
URL: http://svn.apache.org/viewvc/incubator/alois/trunk/rails/app/models/date_condition.rb?rev=1040565&r1=1040564&r2=1040565&view=diff
==============================================================================
--- incubator/alois/trunk/rails/app/models/date_condition.rb (original)
+++ incubator/alois/trunk/rails/app/models/date_condition.rb Tue Nov 30 15:05:26 2010
@@ -36,9 +36,19 @@
       from_date(options) == to_date(options)
     end
 
+    # return quoted date
+    def quoted_date(date, options = {})
+      if table = options[:table_class]
+        date = Time.parse(date.strftime("%F"))
+        table.connection.quoted_date(date)
+      else
+        date.strftime("%F")
+      end
+    end
+
     # The starting date of the range
     def from_date(options = {})
-      range(options).first.strftime("%F")
+      quoted_date(range(options).first, options)
     end
 
     # The starting time of the range
@@ -50,7 +60,7 @@
 
     # The ending date of the range
     def to_date(options = {})
-      range(options).last.strftime("%F")
+      quoted_date(range(options).last, options)
     end
     
     # The ending time of the range



Mime
View raw message