rails/activesupport/CHANGELOG.md
Godfrey Chan ccf8f27ddd Revert "Merge pull request #14269 from arthurnn/expanded_key_array"
This reverts commit 475c96589ca65282e1a61350271c2f83f0d4044f, reversing
changes made to 705915ab5cf24430892107764b0050c07e1df583.

We decided that this is not worth busting everyone's cache as this
seems like a very unlikely problem. The problem only occurs when the
user is 1) not using a namespace, or 2) using the same namesapce for
different *kinds* of cache items. The recommended "fix" is to put
those cache items into their own namspace:

    id = 1
    Rails.cache.fetch(id, namespace: "user"){ User.find(id) }

    ids = [1]
    Rails.cache.fetch(ids, namespace: "users"){ User.find(ids) }

See the discussion on #14269 for details.
2014-03-04 17:58:58 -08:00

1014 B

  • Change the signature of fetch_multi to return a hash rather than an array. This makes it consistent with the output of read_multi.

    Parker Selbert

  • Introduce Concern#class_methods as a sleek alternative to clunky module ClassMethods. Add Kernel#concern to define at the toplevel without chunky module Foo; extend ActiveSupport::Concern boilerplate.

    # app/models/concerns/authentication.rb
    concern :Authentication do
      included do
        after_create :generate_private_key
      end
    
      class_methods do
        def authenticate(credentials)
          # ...
        end
      end
    
      def generate_private_key
        # ...
      end
    end
    
    # app/models/user.rb
    class User < ActiveRecord::Base
      include Authentication
    end
    

    Jeremy Kemper

Please check 4-1-stable for previous changes.