1. 04 8月, 2013 1 次提交
    • T
      Fix active_record_validations.md document, `:save` for `on:` validation helper was never available · 740f7787
      Takehiro Adachi 提交于
      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.
      740f7787
  2. 29 7月, 2013 9 次提交
  3. 28 7月, 2013 19 次提交
  4. 27 7月, 2013 3 次提交
  5. 26 7月, 2013 8 次提交