## Rails 4.2.10 (September 27, 2017) ##
* `Relation#joins` is no longer affected by the target model's
`current_scope`, with the exception of `unscoped`.
Fixes#29338.
*Sean Griffin*
## Rails 4.2.9 (June 26, 2017) ##
* Fix regression caused by `collection_singular_ids=` ignoring different primary key on relationship.
*Nick Pezza*
* Fix `rake db:schema:load` with subdirectories.
*Ryuta Kamizono*
* Fix `rake db:migrate:status` with subdirectories.
*Ryuta Kamizono*
* Fix regression of #1969 with SELECT aliases in HAVING clause.
*Eugene Kenny*
* Fix `wait_timeout` to configurable for mysql2 adapter.
Fixes#26556.
*Ryuta Kamizono*
* Make `table_name=` reset current statement cache,
so queries are not run against the previous table name.
*namusyaka*
Notable changes since 3.2:
- Improve ways to write change migrations, making the old up & down
methods no longer necessary.
- Adds PostgreSQL array type support. Any datatype can be used to
create an array column, with full migration and schema dumper
support.
- Add Relation#load to explicitly load the record and return self.
- Model.all now returns an ActiveRecord::Relation, rather than an
array of records. Use Relation#to_a if you really want an array. In
some specific cases, this may cause breakage when upgrading.
- Added ActiveRecord::Migration.check_pending! that raises an error if
migrations are pending.
- Added custom coders support for ActiveRecord::Store.
- mysql and mysql2 connections will set SQL_MODE=STRICT_ALL_TABLES by
default to avoid silent data loss. This can be disabled by
specifying strict: false in your database.yml.
- Remove IdentityMap.
- Remove automatic execution of EXPLAIN queries. The option
active_record.auto_explain_threshold_in_seconds is no longer used
and should be removed.
- Adds ActiveRecord::NullRelation and ActiveRecord::Relation#none
implementing the null object pattern for the Relation class.
- Added create_join_table migration helper to create HABTM join
tables.
- Allows PostgreSQL hstore records to be created.
- Default scopes are no longer overridden by chained conditions.
- Added ActiveRecord::Base.to_param for convenient "pretty" URLs
derived from a model's attribute or method.
- Added ActiveRecord::Base.no_touching, which allows ignoring touch on
models.
- Unify boolean type casting for MysqlAdapter and
Mysql2Adapter. type_cast will return 1 for true and 0 for false.
- .unscope now removes conditions specified in default_scope.
- Added ActiveRecord::QueryMethods#rewhere which will overwrite an
existing, named where condition.
- Extended ActiveRecord::Base#cache_key to take an optional list of
timestamp attributes of which the highest will be used.
- Added ActiveRecord::Base#enum for declaring enum attributes where
the values map to integers in the database, but can be queried by
name.
- Type cast json values on write, so that the value is consistent with
reading from the database.
- Type cast hstore values on write, so that the value is consistent
with reading from the database.
- Make next_migration_number accessible for third party generators.
- Calling update_attributes will now throw an ArgumentError whenever
it gets a nil argument. More specifically, it will throw an error if
the argument that it gets passed does not respond to to
stringify_keys.
- CollectionAssociation#first/#last (e.g. has_many) use a LIMITed
query to fetch results rather than loading the entire collection.
- inspect on Active Record model classes does not initiate a new
connection. This means that calling inspect, when the database is
missing, will no longer raise an exception.
- Removed column restrictions for count, let the database raise if the
SQL is invalid.
- Rails now automatically detects inverse associations. If you do not
set the :inverse_of option on the association, then Active Record
will guess the inverse association based on heuristics.
- Handle aliased attributes in ActiveRecord::Relation. When using
symbol keys, ActiveRecord will now translate aliased attribute names
to the actual column name used in the database.
- The ERB in fixture files is no longer evaluated in the context of
the main object. Helper methods used by multiple fixtures should be
defined on modules included in
ActiveRecord::FixtureSet.context_class.
- Don't create or drop the test database if RAILS_ENV is specified
explicitly.
- Relation no longer has mutator methods like #map! and
#delete_if. Convert to an Array by calling #to_a before using these
methods.
- find_in_batches, find_each, Result#each and Enumerable#index_by now
return an Enumerator that can calculate its size.
- scope, enum and Associations now raise on "dangerous" name
conflicts.
- second through fifth methods act like the first finder.
- Make touch fire the after_commit and after_rollback callbacks.
- Enable partial indexes for sqlite >= 3.8.0.
- Make change_column_null revertible.
- Added a flag to disable schema dump after migration. This is set to
false by default in the production environment for new applications.
- SchemaDumper uses force: :cascade on create_table. This makes it
possible to reload a schema when foreign keys are in place.
- Added a :required option to singular associations, which defines a
presence validation on the association.
- ActiveRecord::Dirty now detects in-place changes to mutable
values. Serialized attributes on Active Record models are no longer
saved when unchanged. This also works with other types such as
string columns and json columns on PostgreSQL.
- Introduced the db:purge Rake task to empty the database for the
current environment.
- Introduced ActiveRecord::Base#validate! that raises
ActiveRecord::RecordInvalid if the record is invalid.
- Introduced validate as an alias for valid?.
- touch now accepts multiple attributes to be touched at once.
- The PostgreSQL adapter now supports the jsonb datatype in PostgreSQL
9.4+.
- The PostgreSQL and SQLite adapters no longer add a default limit of
255 characters on string columns.
- Added support for the citext column type in the PostgreSQL adapter.
- Added support for user-created range types in the PostgreSQL
adapter.
- sqlite3:///some/path now resolves to the absolute system path
/some/path. For relative paths, use sqlite3:some/path
instead. (Previously, sqlite3:///some/path resolved to the relative
path some/path. This behavior was deprecated on Rails 4.1).
- Added support for fractional seconds for MySQL 5.6 and above.
- Added ActiveRecord::Base#pretty_print to pretty print models.
- ActiveRecord::Base#reload now behaves the same as m =
Model.find(m.id), meaning that it no longer retains the extra
attributes from custom SELECTs.
- ActiveRecord::Base#reflections now returns a hash with string keys
instead of symbol keys.
- The references method in migrations now supports a type option for
specifying the type of the foreign key (e.g. :uuid).