1. 29 5月, 2012 22 次提交
  2. 28 5月, 2012 7 次提交
    • J
      Merge pull request #6517 from purcell/validates-false-value · f5e26bcb
      José Valim 提交于
      Don't enable validations when passing false hash values to ActiveModel.validates
      f5e26bcb
    • S
      Don't enable validations when passing false hash values to ActiveModel.validates · b3ccd7b2
      Steve Purcell 提交于
      Passing a falsey option value for a validator currently causes that validator to
      be enabled, just like "true":
      
          ActiveModel.validates :foo, :presence => false
      
      This is rather counterintuitive, and makes it inconvenient to wrap `validates` in
      methods which may conditionally enable different validators.
      
      As an example, one is currently forced to write:
      
            def has_slug(source_field, options={:unique => true})
              slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
              before_validation slugger
              validations = { :presence => true, :slug => true }
              if options[:unique]
                validations[:uniqueness] = true
              end
              validates :slug, validations
            end
      
      because the following reasonable-looking alternative fails to work as expected:
      
            def has_slug(source_field, options={:unique => true})
              slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? }
              before_validation slugger
              validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique]
            end
      
      (This commit includes a test, and all activemodel and activerecord tests pass as before.)
      b3ccd7b2
    • J
      Merge pull request #6512 from jaredbeck/fix_number_to_currency_neg_format · 5acb10d6
      José Valim 提交于
      Fix handling of negative zero in number_to_currency
      5acb10d6
    • J
      Fix handling of negative zero in number_to_currency · 371508c2
      Jared Beck 提交于
      371508c2
    • J
      Merge pull request #6315 from appfolio/moving_number_helper_methods_to_active_support · 135f6205
      José Valim 提交于
      Moving number helper from ActionView to Active Support
      135f6205
    • P
      Fix sorting of helpers from different paths · e4aaac13
      Piotr Sarnacki 提交于
      When more than one directory for helpers is provided to a controller, it
      should preserver the order of directories. Given 2 paths:
      
          MyController.helpers_paths = ["dir1/helpers", "dir2/helpers"]
      
      helpers from dir1 should be loaded first. Before this commit, all
      helpers were mixed and then sorted alphabetically, which essentially
      would require to rename helpers to get desired order.
      
      This is a problem especially for engines, where you would like to be
      able to predict accurately which engine helpers will load first.
      
      (closes #6496)
      e4aaac13
    • A
      Moving NumberHelpers from ActionView to ActiveSupport · 155cd5e6
      Andrew Mutz 提交于
      155cd5e6
  3. 27 5月, 2012 11 次提交