1. 06 1月, 2015 1 次提交
  2. 05 1月, 2015 6 次提交
  3. 04 1月, 2015 12 次提交
  4. 03 1月, 2015 2 次提交
    • 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 AR callbacks · bb78af73
      claudiob 提交于
      Before this commit, returning `false` in an ActiveRecord `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)`.
      bb78af73
  5. 02 1月, 2015 2 次提交
  6. 31 12月, 2014 3 次提交
  7. 30 12月, 2014 3 次提交
  8. 29 12月, 2014 2 次提交
  9. 28 12月, 2014 4 次提交
  10. 26 12月, 2014 1 次提交
  11. 23 12月, 2014 4 次提交
    • S
      Changelog for 99a6f9e6 · e550bbf8
      Sean Griffin 提交于
      Here you go, @senny. 😁
      e550bbf8
    • Y
      ad783136
    • Y
      cleanup CHANGELOGs. [ci skip] · 05870703
      Yves Senn 提交于
      05870703
    • D
      Fixing numeric attrs when set to same negative value · 2859341c
      Daniel Fox 提交于
      This bug occurs when an attribute of an ActiveRecord model is an
      ActiveRecord::Type::Integer type or a ActiveRecord::Type::Decimal type (or any
      other type that includes the ActiveRecord::Type::Numeric module. When the value
      of the attribute is negative and is set to the same negative value, it is marked
      as changed.
      
      Take the following example of a Person model with the integer attribute age:
      
          class Person < ActiveRecord::Base
            # age          :integer(4)
          end
      
      The following will produce the error:
      
          person = Person.new(age: -1)
          person.age = -1
          person.changes
          => { "age" => [-1, -1] }
          person.age_changed?
          => true
      
      The problematic line is here:
      
          module ActiveRecord
            module Type
              module Numeric
                ...
      
                def non_numeric_string?(value)
                  # 'wibble'.to_i will give zero, we want to make sure
                  # that we aren't marking int zero to string zero as
                  # changed.
                  value.to_s !~ /\A\d+\.?\d*\z/
                end
              end
            end
          end
      
      The regex match doesn't accept numbers with a leading '-'.
      2859341c