aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-05 12:06:43 +0100
committerXavier Noria <fxn@hashref.com>2011-03-05 12:06:43 +0100
commit9092052cb010ab9155cff196ef139cec41695324 (patch)
tree6b8f39ddddef07105820ce825260ebc4e265b12a /railties/guides/source
parent34f5628a072f7afa677d25c9559076d5c21721ce (diff)
parent20768176292cbcb883ab152b4aa9ed8c664771cd (diff)
downloadrails-9092052cb010ab9155cff196ef139cec41695324.tar.gz
rails-9092052cb010ab9155cff196ef139cec41695324.tar.bz2
rails-9092052cb010ab9155cff196ef139cec41695324.zip
merges rails
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile10
-rw-r--r--railties/guides/source/contributing_to_ruby_on_rails.textile15
2 files changed, 23 insertions, 2 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 7becefee09..1df36137b4 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -2793,6 +2793,8 @@ h5. +Date.current+
Active Support defines +Date.current+ to be today in the current time zone. That's like +Date.today+, except that it honors the user time zone, if defined. It also defines +Date.yesterday+ and +Date.tomorrow+, and the instance predicates +past?+, +today?+, and +future?+, all of them relative to +Date.current+.
+When making Date comparisons using methods which honor the user time zone, make sure to use +Date.current+ and not +Date.today+. There are cases where the user time zone might be in the future compared to the system time zone, which +Date.today+ uses by default. This means +Date.today+ may equal +Date.yesterday+.
+
h5. Named dates
h6. +prev_year+, +next_year+
@@ -3107,7 +3109,7 @@ h5. Named Datetimes
h6. +DateTime.current+
-Active Support defines +DateTime.current+ to be like +Time.now.to_datetime+, except that it honors the user time zone, if defined. It also defines instance predicates +past?+, and +future?+ relative to +DateTime.current+.
+Active Support defines +DateTime.current+ to be like +Time.now.to_datetime+, except that it honors the user time zone, if defined. It also defines +DateTime.yesterday+ and +DateTime.tomorrow+, and the instance predicates +past?+, and +future?+ relative to +DateTime.current+.
h5. Other Extensions
@@ -3284,6 +3286,12 @@ t.advance(:seconds => 1)
* If +since+ or +ago+ jump to a time that can't be expressed with +Time+ a +DateTime+ object is returned instead.
+h5. +Time.current+
+
+Active Support defines +Time.current+ to be today in the current time zone. That's like +Time.now+, except that it honors the user time zone, if defined. It also defines +Time.yesterday+ and +Time.tomorrow+, and the instance predicates +past?+, +today?+, and +future?+, all of them relative to +Time.current+.
+
+When making Time comparisons using methods which honor the user time zone, make sure to use +Time.current+ and not +Time.now+. There are cases where the user time zone might be in the future compared to the system time zone, which +Time.today+ uses by default. This means +Time.now+ may equal +Time.yesterday+.
+
h4. Time Constructors
Active Support defines +Time.current+ to be +Time.zone.now+ if there's a user time zone defined, with fallback to +Time.now+:
diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile
index 9739da2666..82e7edfc84 100644
--- a/railties/guides/source/contributing_to_ruby_on_rails.textile
+++ b/railties/guides/source/contributing_to_ruby_on_rails.textile
@@ -349,7 +349,20 @@ $ git commit -a
$ git format-patch master --stdout > my_new_patch.diff
</shell>
-Sanity check the results of this operation: open the diff file in your text editor of choice and make sure that no unintended changes crept in.
+Open the diff file in your text editor of choice to sanity check the results, and make sure that no unintended changes crept in.
+
+You can also perform an extra check by applying the patch to a different dedicated branch:
+
+<shell>
+$ git checkout -b testing_branch
+$ git apply --check my_new_patch.diff
+</shell>
+
+Please make sure the patch does not introduce whitespace errors:
+
+<shell>
+$ git apply --whitespace=error-all mynew_patch.diff
+</shell>
You can check your patches by applying your patch to an different dedicated branch: