Fix GH #4259. We must remove table_name_prefix and table_name_suffix, when we execute schema dumper.
Prevent concurrent compilation of templates - closes #6400

This addresses an issue where in multi-threaded environments
multiple threads can attempt to compile a template at the same time,
which occasionally causes particular templates to end up in a bad
state.

So, add synchronization such that only a single thread can attempt to
compile a template at one time.
Make the Resolver template cache threadsafe  - closes #6404

The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
More granular locking of the Resolver template cache

In order to avoid holding a global lock when doing template
resolution, instead add individual locks on a per cache entry
basis. The global lock is now only used for manipulation of the main
cache data structure.
Improve the readability of the Resolver change detection code
Removing composed_of from ActiveRecord.

This feature adds a lot of complication to ActiveRecord for dubious
value. Let's talk about what it does currently:

class Customer < ActiveRecord::Base
  composed_of :balance, :class_name => "Money", :mapping => %w(balance amount)
end

Instead, you can do something like this:

    def balance
      @balance ||= Money.new(value, currency)
    end

    def balance=(balance)
      self[:value] = balance.value
      self[:currency] = balance.currency
      @balance = balance
    end

Since that's fairly easy code to write, and doesn't need anything
extra from the framework, if you use composed_of today, you'll
have to add accessors/mutators like that.

Closes #1436
Closes #2084
Closes #3807
Merge pull request #6743 from steveklabnik/remove_composed_of

Removing composed_of
Add CHANGELOG entry to composed_of removal
make events not use date and time to determine parent_of. fixes #5932
Ensure that cache-control headers are merged

There are several aspects to this commit, that don't well fit into broken down
commits, so they are detailed here:

 * When a user uses response.headers['Cache-Control'] = some_value, then the
   documented convention in ConditionalGet is not adhered to, in this case,
   response.cache_control is ignored due to `return if
   self[CACHE_CONTROL].present?`
 * When a middleware sets cache-control headers that would clobber, they're
   converted to symbols directly, without underscores. This would lead to bugs.
 * Items that would live in :extras if set through expires_in, are placed
   directly in the @cache_control hash, and not respected in many cases
   (somewhat adhering to the aforementioned documentation).
 * Although quite useless, any directive named 'extras' would be ignored.

The general convention applied is that expires_* take precedence, but no longer
overwrite everything and expires_* are ALWAYS applied, even if the header is
set.

I am still unhappy about the contents of this commit, and the code in general.
Ideally it should be refactored to no longer use :extras. I'd likely recommend
expanding @cache_control into a class, and giving it the power to handle the
merge in a more efficient fashion. Such a commit would be a larger change that
could have additional semantic changes for other libraries unless they utilize
expires_in in very standard ways.
Merge pull request #6775 from takoyakikamen/events

make events not use date and time to determine parent_of. fixes #5932
Make DatabaseTasks a module with real private methods
Refactor Relation#update a bit to avoid an extra Enumerator instance
Fix lookup on HashWithIndifferentAccess for array values.
Use map! instead of replace + map
Merge branch 'hash_with_indifferent_access_fix'

The problem:
Accessing a HashWithIndifferentAccess does not return the the same object
that is stored in the hash (i.e. equal?) causing unexpected results:

    hash = HashWithIndifferentAccess.new {|h, k| h[k] = []}
    hash[:a] << 1  # => [1]
    hash[:a]       # => [], expected [1]

The cause:
When a block is provided to generate default values the generated values
are duped if they are arrays. The duped value is stored in the hash but
the original value is returned when the hash is accessed.

The fix:
The duping is there for allowing frozen arrays containing hashes to be
modified. The fix restricts the duping to this case. Note that if default
function generates a frozen array an error will be raised on assignment
before and after the patch.

Closes #3811
Improve the CHANGELOG entry [ci skip]
Remember the stored attributes in a config attribute.

This allows you to retrieve the list of attributes you've defined.
Usable for e.g. selects in the view, or interators based on the
attributes you wish to store in the serialized column.
Refactor and use class_attribute
Merge pull request #5412 from tilsammans/stored_attributes

Added `stored_attributes` hash which contains the attributes stored using
ActiveRecord::Store. This allows you to retrieve the list of attributes
you've defined.

    class User < ActiveRecord::Base
      store :settings, accessors: [:color, :homepage]
    end

    User.stored_attributes[:settings] # [:color, :homepage]