Skip to content
Browse files

AS guide: documents the extension to Range#to_s

  • Loading branch information...
1 parent e7b3ad5 commit 24a85e0ee50a51631a065825134a32e09685a795 @fxn fxn committed Oct 25, 2009
Showing with 14 additions and 0 deletions.
  1. +14 −0 railties/guides/source/active_support_core_extensions.textile
14 railties/guides/source/active_support_core_extensions.textile
@@ -1625,6 +1625,20 @@ This method is also used in the routes code for building regexps.
h3. Extensions to +Range+
+h4. +to_s+
+Active Support extends the method +Range#to_s+ so that it understands an optional format argument. As of this writing the only supported non-default format is +:db+:
+# => "2009-10-25..2009-10-26"
+# => "BETWEEN '2009-10-25' AND '2009-10-26'"
+As the example depicts, the +:db+ format generates a +BETWEEN+ SQL clause. That is used by Active Record in its support for range values in conditions.
h4. +step+
Active Support extends the method +Range#step+ so that it can be invoked without a block:

0 comments on commit 24a85e0

Please sign in to comment.
Something went wrong with that request. Please try again.