diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index e137eb436fcd09ff59c9a6e05190d74be218e967..6bd1e3acbb802b4bdbb875da72d17d13edefdf7a 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/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+: + + +(Date.today..Date.tomorrow).to_s +# => "2009-10-25..2009-10-26" + +(Date.today..Date.tomorrow).to_s(:db) +# => "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: