1. 04 6月, 2020 10 次提交
    • J
      Unify coverage of collection helpers [ci skip] · d118875d
      Jonathan Hefner 提交于
      Follow-up to #39344.
      
      This adds back coverage of `collection_select`, adds new coverage of
      `collection_radio_buttons`, revises existing coverage of
      `collection_check_boxes`, and unifies these sections.
      d118875d
    • J
      Mention text_area helper [ci skip] · e86e0147
      Jonathan Hefner 提交于
      Follow-up to #39344.
      
      Adds back mention of `text_area` helper.
      e86e0147
    • R
      Ensure alias resolved before `clear_attribute_changes` · 265234b3
      Ryuta Kamizono 提交于
      It is a super edge case but the alias should be resolved before
      `clear_attribute_changes` since `clear_attribute_changes` is not aware
      of attribute aliases.
      265234b3
    • R
      Avoid redundant `to_s` in internal attribute API · 7834363b
      Ryuta Kamizono 提交于
      Redundant `to_s` has a few overhead. Especially private methods are not
      intend to be passed user input directly so it should be passed always
      string.
      
      Removing redundant `to_s` makes attribute methods about 10% faster.
      
      ```ruby
      ActiveRecord::Schema.define do
        create_table :users, force: true do |t|
        end
      end
      
      class User < ActiveRecord::Base
        def fast_read_attribute(attr_name, &block)
          @attributes.fetch_value(attr_name, &block)
        end
      end
      
      user = User.create!
      
      Benchmark.ips do |x|
        x.report("user._read_attribute('id')") { user._read_attribute("id") }
        x.report("user.fast_read_attribute('id')") { user.fast_read_attribute("id") }
      end
      ```
      
      ```
      Warming up --------------------------------------
      user._read_attribute('id')
                             272.151k i/100ms
      user.fast_read_attribute('id')
                             283.518k i/100ms
      Calculating -------------------------------------
      user._read_attribute('id')
                                2.699M (± 1.3%) i/s -     13.608M in   5.042846s
      user.fast_read_attribute('id')
                                2.988M (± 1.2%) i/s -     15.026M in   5.029056s
      ```
      7834363b
    • R
      Merge pull request #39530 from kamipo/clear_attribute_change_as_attribute_method · 95154c93
      Ryuta Kamizono 提交于
      Promote `clear_attribute_change` as attribute methods
      95154c93
    • E
      Merge pull request #38867 from BoboFraggins/do_not_dirty_models_on_case_insensitive_values · 5fdf76f8
      Eugene Kenny 提交于
      Do not mark attributes as changed when the type is case insensitive a…
      5fdf76f8
    • P
      Do not mark Postgresql MAC address and UUID attributes as changed when the... · 37f3b4dc
      Peter Fry 提交于
      Do not mark Postgresql MAC address and UUID attributes as changed when the assigned value only varies by case.
      
      Fix Rubocop warnings.
      
      Fix merge conflict error.
      
      Fix merge conflict error.
      37f3b4dc
    • R
      Promote `clear_attribute_change` as attribute methods · 6f1bf2a3
      Ryuta Kamizono 提交于
      For now, `increment` with aliased attribute does work, but `increment!`
      with aliased attribute does not work, due to `clear_attribute_change` is
      not aware of attribute aliases.
      
      We sometimes partially updates specific attributes in dirties, at that
      time it relies on `clear_attribute_change` to clear partially updated
      attribute dirties. If `clear_attribute_change` is not attribute method
      unlike others, we need to resolve attribute aliases manually only for
      `clear_attribute_change`, it is a little inconvinient for me.
      
      From another point of view, we have `restore_attributes`,
      `restore_attribute!`, `clear_attribute_changes`, and
      `clear_attribute_change`. Despite almost similar features
      `restore_attribute!` is an attribute method but `clear_attribute_change`
      is not.
      
      Given the above, I'd like to promote `clear_attribute_change` as
      attribute methods to fix issues caused by the inconsisteny.
      6f1bf2a3
    • A
      Merge pull request #39477 from p8/improve-inspect · 35fe9bc0
      Aaron Patterson 提交于
      Make custom inspect methods more consistent
      35fe9bc0
    • R
      4dbbba4a
  2. 03 6月, 2020 16 次提交
  3. 02 6月, 2020 10 次提交
  4. 01 6月, 2020 4 次提交