aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorTakehiro Adachi <takehiro0740@gmail.com>2013-08-03 23:05:11 +0900
committerTakehiro Adachi <takehiro0740@gmail.com>2013-08-04 18:37:12 +0900
commit740f7787e0b2db6bc476e85774f7a7044e1f983a (patch)
tree9953ad8f376b8f8a1bbffc73cfb7ea05f2722d63 /railties/lib
parentb67a80de9b55f91feb1c1056824f456710a96d0d (diff)
downloadrails-740f7787e0b2db6bc476e85774f7a7044e1f983a.tar.gz
rails-740f7787e0b2db6bc476e85774f7a7044e1f983a.tar.bz2
rails-740f7787e0b2db6bc476e85774f7a7044e1f983a.zip
Fix active_record_validations.md document, `:save` for `on:` validation helper was never available
According to the guide, ":save" value for the "on:" validation helper was available like below validates :name, presence: true, on: :save but this was never available according to the implementation of the valid? method, which is below # Runs all the validations within the specified context. Returns +true+ if # no errors are found, +false+ otherwise. # # If the argument is +false+ (default is +nil+), the context is set to <tt>:create</tt> if # <tt>new_record?</tt> is +true+, and to <tt>:update</tt> if it is not. # # Validations with no <tt>:on</tt> option will run no matter the context. Validations with # some <tt>:on</tt> option will only run in the specified context. def valid?(context = nil) context ||= (new_record? ? :create : :update) output = super(context) errors.empty? && output end So the documentation was always wrong since the PR proposed by @neerajdotname ( #10287 ) was rejected.
Diffstat (limited to 'railties/lib')
0 files changed, 0 insertions, 0 deletions