1. 30 3月, 2015 1 次提交
    • S
      Deprecate the `:tokenizer` option to `validates_length_of` · 1c341eb7
      Sean Griffin 提交于
      As demonstrated by #19570, this option is severely limited, and
      satisfies an extremely specific use case. Realistically, there's not
      much reason for this option to exist. Its functionality can be trivially
      replicated with a normal Ruby method. Let's deprecate this option, in
      favor of the simpler solution.
      1c341eb7
  2. 23 2月, 2015 1 次提交
  3. 19 2月, 2015 1 次提交
  4. 01 2月, 2015 2 次提交
  5. 31 1月, 2015 1 次提交
  6. 28 1月, 2015 1 次提交
  7. 24 1月, 2015 3 次提交
  8. 21 1月, 2015 1 次提交
    • W
      Add ActiveModel::Errors#details · cb74473d
      Wojciech Wnętrzak 提交于
      To be able to return type of validator, one can now call `details`
      on Errors instance:
      
      ```ruby
      class User < ActiveRecord::Base
        validates :name, presence: true
      end
      ```
      
      ```ruby
      user = User.new; user.valid?; user.errors.details
      => {name: [{error: :blank}]}
      ```
      cb74473d
  9. 11 1月, 2015 1 次提交
  10. 04 1月, 2015 1 次提交
  11. 03 1月, 2015 3 次提交
    • C
      Add config to halt callback chain on return false · 9c65c539
      claudiob 提交于
      This stems from [a comment](rails#17227 (comment)) by @dhh.
      In summary:
      
      * New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
      * Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.
      
      For this purpose, this commit introduces a Rails configuration option:
      
      ```ruby
      config.active_support.halt_callback_chains_on_return_false
      ```
      
      For new Rails 5.0 apps, this option will be set to `false` by a new initializer
      `config/initializers/callback_terminator.rb`:
      
      ```ruby
      Rails.application.config.active_support.halt_callback_chains_on_return_false = false
      ```
      
      For existing apps ported to Rails 5.0, the initializers above will not exist.
      Even running `rake rails:update` will not create this initializer.
      
      Since the default value of `halt_callback_chains_on_return_false` is set to
      `true`, these apps will still accept `return true` as a way to halt callback
      chains, displaying a deprecation warning.
      
      Developers will be able to switch to the new behavior (and stop the warning)
      by manually adding the line above to their `config/application.rb`.
      
      A gist with the suggested release notes to add to Rails 5.0 after this
      commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931
      9c65c539
    • C
      Deprecate `false` as the way to halt AM callbacks · 91b81293
      claudiob 提交于
      Before this commit, returning `false` in an ActiveModel `before_` callback
      such as `before_create` would halt the callback chain.
      
      After this commit, the behavior is deprecated: will still work until
      the next release of Rails but will also display a deprecation warning.
      
      The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
      91b81293
    • C
      Deprecate `false` as the way to halt AM validation callbacks · f7679812
      claudiob 提交于
      Before this commit, returning `false` in an ActiveModel validation
      callback such as `before_validation` would halt the callback chain.
      
      After this commit, the behavior is deprecated: will still work until
      the next release of Rails but will also display a deprecation warning.
      
      The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
      f7679812
  12. 29 11月, 2014 1 次提交
  13. 18 9月, 2014 1 次提交
  14. 07 8月, 2014 2 次提交
  15. 03 8月, 2014 1 次提交
  16. 18 7月, 2014 1 次提交
    • S
      check for valid options in validate method · 0950d409
      sonnym 提交于
      This change prevents a certain class of user error which results when
      mistakenly using the `validate` class method instead of the `validates`
      class method.
      
      Only apply when all arguments are symbols, because some validations use
      the `validate` method and pass in additional options, namely the
      `LenghValidator` via the `ActiveMode::Validations::validates_with`
      method.
      0950d409
  17. 16 7月, 2014 2 次提交
  18. 01 7月, 2014 2 次提交
  19. 22 6月, 2014 1 次提交
  20. 14 6月, 2014 1 次提交
  21. 11 6月, 2014 2 次提交
  22. 16 5月, 2014 1 次提交
  23. 03 5月, 2014 1 次提交
  24. 02 5月, 2014 1 次提交
  25. 28 3月, 2014 1 次提交
  26. 25 2月, 2014 1 次提交
  27. 04 2月, 2014 1 次提交
  28. 30 1月, 2014 1 次提交
  29. 27 1月, 2014 1 次提交
  30. 07 1月, 2014 1 次提交
  31. 15 12月, 2013 1 次提交