2013-08-27 22:41:29 -04:00
|
|
|
* Fix inserts with prepared statements disabled.
|
|
|
|
|
|
|
|
Fixes #12023.
|
|
|
|
|
|
|
|
*Rafael Mendonça França*
|
|
|
|
|
2013-09-04 18:36:28 -04:00
|
|
|
* Setting a has_one association on a new record no longer causes an empty
|
|
|
|
transaction.
|
|
|
|
|
|
|
|
*Dylan Thacker-Smith*
|
|
|
|
|
2013-09-11 08:18:31 -04:00
|
|
|
* Fix `AR::Relation#merge` sometimes failing to preserve `readonly(false)` flag.
|
|
|
|
|
|
|
|
*thedarkone*
|
|
|
|
|
2013-08-21 03:49:18 -04:00
|
|
|
* Re-use `order` argument pre-processing for `reorder`.
|
|
|
|
|
|
|
|
*Paul Nikitochkin*
|
|
|
|
|
2013-09-08 18:55:35 -04:00
|
|
|
* Fix PredicateBuilder so polymorphic association keys in `where` clause can
|
|
|
|
accept objects other than direct descendants of `ActiveRecord::Base` (decorated
|
2013-08-20 07:21:23 -04:00
|
|
|
models, for example).
|
|
|
|
|
|
|
|
*Mikhail Dieterle*
|
|
|
|
|
2013-08-26 05:14:56 -04:00
|
|
|
* PostgreSQL adapter recognizes negative money values formatted with
|
|
|
|
parentheses (eg. `($1.25) # => -1.25`)).
|
|
|
|
Fixes #11899.
|
|
|
|
|
2013-08-30 00:00:42 -04:00
|
|
|
*Yves Senn*
|
2013-08-26 05:14:56 -04:00
|
|
|
|
2013-08-20 12:24:48 -04:00
|
|
|
* Stop interpreting SQL 'string' columns as :string type because there is no
|
|
|
|
common STRING datatype in SQL.
|
|
|
|
|
|
|
|
*Ben Woosley*
|
|
|
|
|
2013-08-19 08:39:51 -04:00
|
|
|
* `ActiveRecord::FinderMethods#exists?` returns `true`/`false` in all cases.
|
|
|
|
|
|
|
|
*Xavier Noria*
|
|
|
|
|
2013-07-23 15:33:53 -04:00
|
|
|
* Assign inet/cidr attribute with `nil` value for invalid address.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
record = User.new
|
|
|
|
record.logged_in_from_ip # is type of an inet or a cidr
|
|
|
|
|
|
|
|
# Before:
|
|
|
|
record.logged_in_from_ip = 'bad ip address' # raise exception
|
|
|
|
|
|
|
|
# After:
|
|
|
|
record.logged_in_from_ip = 'bad ip address' # do not raise exception
|
|
|
|
record.logged_in_from_ip # => nil
|
|
|
|
record.logged_in_from_ip_before_type_cast # => 'bad ip address'
|
|
|
|
|
|
|
|
*Paul Nikitochkin*
|
|
|
|
|
2013-07-20 20:23:45 -04:00
|
|
|
* `add_to_target` now accepts a second optional `skip_callbacks` argument
|
|
|
|
|
|
|
|
If truthy, it will skip the :before_add and :after_add callbacks.
|
|
|
|
|
|
|
|
*Ben Woosley*
|
|
|
|
|
2012-03-16 07:26:24 -04:00
|
|
|
* Fix interactions between `:before_add` callbacks and nested attributes
|
|
|
|
assignment of `has_many` associations, when the association was not
|
|
|
|
yet loaded:
|
|
|
|
|
|
|
|
- A `:before_add` callback was being called when a nested attributes
|
|
|
|
assignment assigned to an existing record.
|
|
|
|
|
|
|
|
- Nested Attributes assignment did not affect the record in the
|
|
|
|
association target when a `:before_add` callback triggered the
|
|
|
|
loading of the association
|
|
|
|
|
|
|
|
*Jörg Schray*
|
|
|
|
|
2013-08-10 03:25:04 -04:00
|
|
|
* Allow enable_extension migration method to be revertible.
|
2012-03-16 07:26:24 -04:00
|
|
|
|
2013-08-10 03:25:04 -04:00
|
|
|
*Eric Tipton*
|
|
|
|
|
2013-08-07 09:17:15 -04:00
|
|
|
* Type cast hstore values on write, so that the value is consistent
|
|
|
|
with reading from the database.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
x = Hstore.new tags: {"bool" => true, "number" => 5}
|
|
|
|
|
|
|
|
# Before:
|
|
|
|
x.tags # => {"bool" => true, "number" => 5}
|
|
|
|
|
|
|
|
# After:
|
|
|
|
x.tags # => {"bool" => "true", "number" => "5"}
|
|
|
|
|
|
|
|
*Yves Senn* , *Severin Schoepke*
|
|
|
|
|
2013-08-07 12:21:45 -04:00
|
|
|
* Fix multidimensional PG arrays containing non-string items.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-08-06 08:22:39 -04:00
|
|
|
* Load fixtures from linked folders.
|
|
|
|
|
|
|
|
*Kassio Borges*
|
|
|
|
|
2013-08-05 11:12:12 -04:00
|
|
|
* Create a directory for sqlite3 file if not present on the system.
|
|
|
|
|
|
|
|
*Richard Schneeman*
|
|
|
|
|
2013-08-02 03:27:37 -04:00
|
|
|
* Removed redundant override of `xml` column definition for PG,
|
2013-08-02 08:45:12 -04:00
|
|
|
in order to use `xml` column type instead of `text`.
|
2013-08-02 03:27:37 -04:00
|
|
|
|
|
|
|
*Paul Nikitochkin*, *Michael Nikitochkin*
|
|
|
|
|
2013-07-29 22:18:33 -04:00
|
|
|
* Revert `ActiveRecord::Relation#order` change that make new order
|
|
|
|
prepend the old one.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
|
|
|
User.order("name asc").order("created_at desc")
|
|
|
|
# SELECT * FROM users ORDER BY created_at desc, name asc
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
|
|
|
User.order("name asc").order("created_at desc")
|
|
|
|
# SELECT * FROM users ORDER BY name asc, created_at desc
|
|
|
|
|
|
|
|
This also affects order defined in `default_scope` or any kind of associations.
|
|
|
|
|
2013-05-17 20:23:57 -04:00
|
|
|
* Add ability to define how a class is converted to Arel predicates.
|
|
|
|
For example, adding a very vendor specific regex implementation:
|
|
|
|
|
|
|
|
regex_handler = proc do |column, value|
|
|
|
|
Arel::Nodes::InfixOperation.new('~', column, value.source)
|
|
|
|
end
|
|
|
|
ActiveRecord::PredicateBuilder.register_handler(Regexp, regex_handler)
|
|
|
|
|
|
|
|
*Sean Griffin & @joannecheng*
|
|
|
|
|
2013-07-20 23:30:35 -04:00
|
|
|
* Don't allow `quote_value` to be called without a column.
|
|
|
|
|
|
|
|
Some adapters require column information to do their job properly.
|
|
|
|
By enforcing the provision of the column for this internal method
|
|
|
|
we ensure that those using adapters that require column information
|
|
|
|
will always get the proper behavior.
|
|
|
|
|
|
|
|
*Ben Woosley*
|
|
|
|
|
2013-07-20 23:15:48 -04:00
|
|
|
* When using optimistic locking, `update` was not passing the column to `quote_value`
|
2012-06-17 11:43:31 -04:00
|
|
|
to allow the connection adapter to properly determine how to quote the value. This was
|
2013-08-02 03:03:35 -04:00
|
|
|
affecting certain databases that use specific column types.
|
2013-07-20 23:15:48 -04:00
|
|
|
|
|
|
|
Fixes: #6763
|
2012-06-17 11:43:31 -04:00
|
|
|
|
|
|
|
*Alfred Wong*
|
|
|
|
|
2013-07-21 16:11:41 -04:00
|
|
|
* rescue from all exceptions in `ConnectionManagement#call`
|
|
|
|
|
|
|
|
Fixes #11497
|
|
|
|
|
|
|
|
As `ActiveRecord::ConnectionAdapters::ConnectionManagement` middleware does
|
|
|
|
not rescue from Exception (but only from StandardError), the Connection
|
|
|
|
Pool quickly runs out of connections when multiple erroneous Requests come
|
|
|
|
in right after each other.
|
|
|
|
|
|
|
|
Rescuing from all exceptions and not just StandardError, fixes this
|
|
|
|
behaviour.
|
|
|
|
|
|
|
|
*Vipul A M*
|
|
|
|
|
2013-07-16 03:49:55 -04:00
|
|
|
* `change_column` for PostgreSQL adapter respects the `:array` option.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-03 17:11:54 -04:00
|
|
|
* Remove deprecation warning from `attribute_missing` for attributes that are columns.
|
|
|
|
|
|
|
|
*Arun Agrawal*
|
|
|
|
|
2013-07-08 05:31:07 -04:00
|
|
|
* Remove extra decrement of transaction deep level.
|
|
|
|
|
|
|
|
Fixes: #4566
|
|
|
|
|
|
|
|
*Paul Nikitochkin*
|
|
|
|
|
2013-07-13 14:02:47 -04:00
|
|
|
* Reset @column_defaults when assigning `locking_column`.
|
|
|
|
We had a potential problem. For example:
|
|
|
|
|
|
|
|
class Post < ActiveRecord::Base
|
|
|
|
self.column_defaults # if we call this unintentionally before setting locking_column ...
|
|
|
|
self.locking_column = 'my_locking_column'
|
|
|
|
end
|
|
|
|
|
|
|
|
Post.column_defaults["my_locking_column"]
|
|
|
|
=> nil # expected value is 0 !
|
|
|
|
|
|
|
|
*kennyj*
|
|
|
|
|
2013-07-04 18:13:59 -04:00
|
|
|
* Remove extra select and update queries on save/touch/destroy ActiveRecord model
|
|
|
|
with belongs to reflection with option `touch: true`.
|
|
|
|
|
|
|
|
Fixes: #11288
|
|
|
|
|
|
|
|
*Paul Nikitochkin*
|
|
|
|
|
2013-07-04 04:16:11 -04:00
|
|
|
* Remove deprecated nil-passing to the following `SchemaCache` methods:
|
|
|
|
`primary_keys`, `tables`, `columns` and `columns_hash`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-04 04:02:20 -04:00
|
|
|
* Remove deprecated block filter from `ActiveRecord::Migrator#migrate`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-04 03:49:03 -04:00
|
|
|
* Remove deprecated String constructor from `ActiveRecord::Migrator`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-03 15:48:52 -04:00
|
|
|
* Remove deprecated `scope` use without passing a callable object.
|
|
|
|
|
|
|
|
*Arun Agrawal*
|
|
|
|
|
2013-07-03 14:52:56 -04:00
|
|
|
* Remove deprecated `transaction_joinable=` in favor of `begin_transaction`
|
|
|
|
with `:joinable` option.
|
|
|
|
|
|
|
|
*Arun Agrawal*
|
|
|
|
|
2013-07-03 15:40:20 -04:00
|
|
|
* Remove deprecated `decrement_open_transactions`.
|
|
|
|
|
|
|
|
*Arun Agrawal*
|
|
|
|
|
2013-07-03 14:48:49 -04:00
|
|
|
* Remove deprecated `increment_open_transactions`.
|
|
|
|
|
|
|
|
*Arun Agrawal*
|
|
|
|
|
2013-07-03 14:49:57 -04:00
|
|
|
* Remove deprecated `PostgreSQLAdapter#outside_transaction?`
|
|
|
|
method. You can use `#transaction_open?` instead.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-02 23:14:04 -04:00
|
|
|
* Remove deprecated `ActiveRecord::Fixtures.find_table_name` in favor of
|
|
|
|
`ActiveRecord::Fixtures.default_fixture_model_name`.
|
|
|
|
|
|
|
|
*Vipul A M*
|
|
|
|
|
2013-07-02 22:49:15 -04:00
|
|
|
* Removed deprecated `columns_for_remove` from `SchemaStatements`.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-02 17:41:17 -04:00
|
|
|
* Remove deprecated `SchemaStatements#distinct`.
|
|
|
|
|
|
|
|
*Francesco Rodriguez*
|
|
|
|
|
2013-07-02 16:08:04 -04:00
|
|
|
* Move deprecated `ActiveRecord::TestCase` into the rails test
|
|
|
|
suite. The class is no longer public and is only used for internal
|
|
|
|
Rails tests.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-02 15:16:39 -04:00
|
|
|
* Removed support for deprecated option `:restrict` for `:dependent`
|
|
|
|
in associations.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-02 14:38:48 -04:00
|
|
|
* Removed support for deprecated `delete_sql` in associations.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-02 14:07:08 -04:00
|
|
|
* Removed support for deprecated `insert_sql` in associations.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-02 12:26:51 -04:00
|
|
|
* Removed support for deprecated `finder_sql` in associations.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-02 10:47:36 -04:00
|
|
|
* Support array as root element in JSON fields.
|
|
|
|
|
|
|
|
*Alexey Noskov & Francesco Rodriguez*
|
|
|
|
|
2013-07-02 02:54:12 -04:00
|
|
|
* Removed support for deprecated `counter_sql` in associations.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-05-13 17:10:23 -04:00
|
|
|
* Do not invoke callbacks when `delete_all` is called on collection.
|
2013-07-01 22:41:32 -04:00
|
|
|
|
2013-05-13 17:10:23 -04:00
|
|
|
Method `delete_all` should not be invoking callbacks and this
|
|
|
|
feature was deprecated in Rails 4.0. This is being removed.
|
|
|
|
`delete_all` will continue to honor the `:dependent` option. However
|
|
|
|
if `:dependent` value is `:destroy` then the default deletion
|
|
|
|
strategy for that collection will be applied.
|
|
|
|
|
|
|
|
User can also force a deletion strategy by passing parameter to
|
|
|
|
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)` .
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 21:38:12 -04:00
|
|
|
* Calling default_scope without a proc will now raise `ArgumentError`.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 22:06:34 -04:00
|
|
|
* Removed deprecated method `type_cast_code` from Column.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 15:37:02 -04:00
|
|
|
* Removed deprecated options `delete_sql` and `insert_sql` from HABTM
|
|
|
|
association.
|
|
|
|
|
|
|
|
Removed deprecated options `finder_sql` and `counter_sql` from
|
|
|
|
collection association.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 16:44:24 -04:00
|
|
|
* Remove deprecated `ActiveRecord::Base#connection` method.
|
|
|
|
Make sure to access it via the class.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-01 15:59:43 -04:00
|
|
|
* Remove deprecation warning for `auto_explain_threshold_in_seconds`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-01 16:11:20 -04:00
|
|
|
* Remove deprecated `:distinct` option from `Relation#count`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-07-01 13:43:03 -04:00
|
|
|
* Removed deprecated methods `partial_updates`, `partial_updates?` and
|
|
|
|
`partial_updates=`.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 07:54:42 -04:00
|
|
|
* Removed deprecated method `scoped`
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-07-01 07:29:34 -04:00
|
|
|
* Removed deprecated method `default_scopes?`
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-06-27 15:46:24 -04:00
|
|
|
* Remove implicit join references that were deprecated in 4.0.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
# before with implicit joins
|
|
|
|
Comment.where('posts.author_id' => 7)
|
|
|
|
|
|
|
|
# after
|
|
|
|
Comment.references(:posts).where('posts.author_id' => 7)
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-04-19 07:52:44 -04:00
|
|
|
* Apply default scope when joining associations. For example:
|
|
|
|
|
|
|
|
class Post < ActiveRecord::Base
|
|
|
|
default_scope -> { where published: true }
|
|
|
|
end
|
|
|
|
|
|
|
|
class Comment
|
|
|
|
belongs_to :post
|
|
|
|
end
|
|
|
|
|
|
|
|
When calling `Comment.joins(:post)`, we expect to receive only
|
|
|
|
comments on published posts, since that is the default scope for
|
|
|
|
posts.
|
|
|
|
|
|
|
|
Before this change, the default scope from `Post` was not applied,
|
|
|
|
so we'd get comments on unpublished posts.
|
|
|
|
|
|
|
|
*Jon Leighton*
|
|
|
|
|
2013-06-27 13:56:30 -04:00
|
|
|
* Remove `activerecord-deprecated_finders` as a dependency
|
|
|
|
|
|
|
|
*Łukasz Strzałkowski*
|
|
|
|
|
2013-06-25 19:58:43 -04:00
|
|
|
* Remove Oracle / Sqlserver / Firebird database tasks that were deprecated in 4.0.
|
|
|
|
|
|
|
|
*kennyj*
|
|
|
|
|
2013-06-18 05:21:52 -04:00
|
|
|
* `find_each` now returns an `Enumerator` when called without a block, so that it
|
|
|
|
can be chained with other `Enumerable` methods.
|
|
|
|
|
|
|
|
*Ben Woosley*
|
|
|
|
|
2013-06-18 06:32:01 -04:00
|
|
|
* `ActiveRecord::Result.each` now returns an `Enumerator` when called without
|
|
|
|
a block, so that it can be chained with other `Enumerable` methods.
|
|
|
|
|
|
|
|
*Ben Woosley*
|
|
|
|
|
2013-05-29 23:36:19 -04:00
|
|
|
* Flatten merged join_values before building the joins.
|
2013-06-25 04:12:10 -04:00
|
|
|
|
2013-05-29 23:36:19 -04:00
|
|
|
While joining_values special treatment is given to string values.
|
|
|
|
By flattening the array it ensures that string values are detected
|
|
|
|
as strings and not arrays.
|
|
|
|
|
|
|
|
Fixes #10669.
|
|
|
|
|
|
|
|
*Neeraj Singh and iwiznia*
|
|
|
|
|
2013-05-11 00:34:25 -04:00
|
|
|
* Do not load all child records for inverse case.
|
|
|
|
|
|
|
|
currently `post.comments.find(Comment.first.id)` would load all
|
|
|
|
comments for the given post to set the inverse association.
|
|
|
|
|
|
|
|
This has a huge performance penalty. Because if post has 100k
|
|
|
|
records and all these 100k records would be loaded in memory
|
|
|
|
even though the comment id was supplied.
|
|
|
|
|
|
|
|
Fix is to use in-memory records only if loaded? is true. Otherwise
|
|
|
|
load the records using full sql.
|
|
|
|
|
|
|
|
Fixes #10509.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-06-19 12:27:13 -04:00
|
|
|
* `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.
|
|
|
|
Fixes #10936.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
Author.inspect # => "Author(no database connection)"
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-06-19 12:28:49 -04:00
|
|
|
* Handle single quotes in PostgreSQL default column values.
|
|
|
|
Fixes #10881.
|
|
|
|
|
|
|
|
*Dylan Markow*
|
|
|
|
|
2013-06-18 04:46:33 -04:00
|
|
|
* Log the sql that is actually sent to the database.
|
|
|
|
|
|
|
|
If I have a query that produces sql
|
|
|
|
`WHERE "users"."name" = 'a b'` then in the log all the
|
|
|
|
whitespace is being squeezed. So the sql that is printed in the
|
|
|
|
log is `WHERE "users"."name" = 'a b'`.
|
|
|
|
|
|
|
|
Do not squeeze whitespace out of sql queries. Fixes #10982.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-06-10 07:52:22 -04:00
|
|
|
* Fixture setup does no longer depend on `ActiveRecord::Base.configurations`.
|
|
|
|
This is relevant when `ENV["DATABASE_URL"]` is used in place of a `database.yml`.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-06-12 08:15:15 -04:00
|
|
|
* Fix mysql2 adapter raises the correct exception when executing a query on a
|
|
|
|
closed connection.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-06-13 12:46:30 -04:00
|
|
|
* Ambiguous reflections are on :through relationships are no longer supported.
|
|
|
|
For example, you need to change this:
|
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Author < ActiveRecord::Base
|
|
|
|
has_many :posts
|
|
|
|
has_many :taggings, :through => :posts
|
|
|
|
end
|
2013-06-15 08:34:55 -04:00
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Post < ActiveRecord::Base
|
|
|
|
has_one :tagging
|
|
|
|
has_many :taggings
|
|
|
|
end
|
2013-06-15 08:34:55 -04:00
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Tagging < ActiveRecord::Base
|
|
|
|
end
|
2013-06-13 12:46:30 -04:00
|
|
|
|
|
|
|
To this:
|
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Author < ActiveRecord::Base
|
|
|
|
has_many :posts
|
|
|
|
has_many :taggings, :through => :posts, :source => :tagging
|
|
|
|
end
|
2013-06-15 08:34:55 -04:00
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Post < ActiveRecord::Base
|
|
|
|
has_one :tagging
|
|
|
|
has_many :taggings
|
|
|
|
end
|
2013-06-15 08:34:55 -04:00
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Tagging < ActiveRecord::Base
|
|
|
|
end
|
2013-06-13 12:46:30 -04:00
|
|
|
|
2013-06-25 23:55:28 -04:00
|
|
|
*Aaron Patterson*
|
2013-06-18 15:16:26 -04:00
|
|
|
|
2013-05-13 13:31:00 -04:00
|
|
|
* Remove column restrictions for `count`, let the database raise if the SQL is
|
2013-06-12 05:45:52 -04:00
|
|
|
invalid. The previous behavior was untested and surprising for the user.
|
2013-05-13 13:31:00 -04:00
|
|
|
Fixes #5554.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
User.select("name, username").count
|
|
|
|
# Before => SELECT count(*) FROM users
|
|
|
|
# After => ActiveRecord::StatementInvalid
|
|
|
|
|
|
|
|
# you can still use `count(:all)` to perform a query unrelated to the
|
|
|
|
# selected columns
|
|
|
|
User.select("name, username").count(:all) # => SELECT count(*) FROM users
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-06-07 23:59:27 -04:00
|
|
|
* 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.
|
|
|
|
|
|
|
|
Note that automatic inverse detection only works on `has_many`, `has_one`,
|
|
|
|
and `belongs_to` associations. Extra options on the associations will
|
|
|
|
also prevent the association's inverse from being found automatically.
|
|
|
|
|
|
|
|
The automatic guessing of the inverse association uses a heuristic based
|
|
|
|
on the name of the class, so it may not work for all associations,
|
|
|
|
especially the ones with non-standard names.
|
|
|
|
|
|
|
|
You can turn off the automatic detection of inverse associations by setting
|
|
|
|
the `:inverse_of` option to `false` like so:
|
|
|
|
|
2013-06-18 15:12:24 -04:00
|
|
|
class Taggable < ActiveRecord::Base
|
|
|
|
belongs_to :tag, inverse_of: false
|
|
|
|
end
|
2013-06-07 23:59:27 -04:00
|
|
|
|
|
|
|
*John Wang*
|
|
|
|
|
2013-05-05 22:06:12 -04:00
|
|
|
* Fix `add_column` with `array` option when using PostgreSQL. Fixes #10432
|
|
|
|
|
|
|
|
*Adam Anderson*
|
|
|
|
|
2013-05-27 10:52:42 -04:00
|
|
|
* Usage of `implicit_readonly` is being removed`. Please use `readonly` method
|
|
|
|
explicitly to mark records as `readonly.
|
|
|
|
Fixes #10615.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
user = User.joins(:todos).select("users.*, todos.title as todos_title").readonly(true).first
|
|
|
|
user.todos_title = 'clean pet'
|
|
|
|
user.save! # will raise error
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-05-21 11:59:37 -04:00
|
|
|
* Fix the `:primary_key` option for `has_many` associations.
|
|
|
|
Fixes #10693.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2013-06-12 05:45:52 -04:00
|
|
|
* Fix bug where tiny types are incorrectly coerced as boolean when the length is more than 1.
|
2013-05-22 13:40:32 -04:00
|
|
|
|
|
|
|
Fixes #10620.
|
|
|
|
|
2013-06-25 23:55:28 -04:00
|
|
|
*Aaron Patterson*
|
2013-05-22 13:40:32 -04:00
|
|
|
|
2013-05-18 09:52:46 -04:00
|
|
|
* Also support extensions in PostgreSQL 9.1. This feature has been supported since 9.1.
|
2013-05-07 13:45:35 -04:00
|
|
|
|
|
|
|
*kennyj*
|
|
|
|
|
2013-05-12 13:49:49 -04:00
|
|
|
* Deprecate `ConnectionAdapters::SchemaStatements#distinct`,
|
|
|
|
as it is no longer used by internals.
|
|
|
|
|
2013-06-18 15:16:26 -04:00
|
|
|
*Ben Woosley*
|
2013-05-12 13:49:49 -04:00
|
|
|
|
2013-05-11 22:51:27 -04:00
|
|
|
* Fix pending migrations error when loading schema and `ActiveRecord::Base.table_name_prefix`
|
|
|
|
is not blank.
|
2013-05-11 22:32:33 -04:00
|
|
|
|
2013-05-11 22:51:27 -04:00
|
|
|
Call `assume_migrated_upto_version` on connection to prevent it from first
|
|
|
|
being picked up in `method_missing`.
|
|
|
|
|
|
|
|
In the base class, `Migration`, `method_missing` expects the argument to be a
|
|
|
|
table name, and calls `proper_table_name` on the arguments before sending to
|
|
|
|
`connection`. If `table_name_prefix` or `table_name_suffix` is used, the schema
|
|
|
|
version changes to `prefix_version_suffix`, breaking `rake test:prepare`.
|
2013-05-11 22:32:33 -04:00
|
|
|
|
|
|
|
Fixes #10411.
|
|
|
|
|
|
|
|
*Kyle Stevens*
|
|
|
|
|
2013-05-11 22:51:27 -04:00
|
|
|
* Method `read_attribute_before_type_cast` should accept input as symbol.
|
2013-05-11 03:08:08 -04:00
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-05-06 18:31:20 -04:00
|
|
|
* Confirm a record has not already been destroyed before decrementing counter cache.
|
|
|
|
|
|
|
|
*Ben Tucker*
|
|
|
|
|
2013-05-06 21:22:43 -04:00
|
|
|
* Fixed a bug in `ActiveRecord#sanitize_sql_hash_for_conditions` in which
|
|
|
|
`self.class` is an argument to `PredicateBuilder#build_from_hash`
|
2013-05-07 13:04:11 -04:00
|
|
|
causing `PredicateBuilder` to call non-existent method
|
2013-05-06 21:22:43 -04:00
|
|
|
`Class#reflect_on_association`.
|
2013-04-25 20:20:33 -04:00
|
|
|
|
|
|
|
*Zach Ohlgren*
|
|
|
|
|
2013-05-03 00:46:18 -04:00
|
|
|
* While removing index if column option is missing then raise IrreversibleMigration exception.
|
|
|
|
|
|
|
|
Following code should raise `IrreversibleMigration`. But the code was
|
|
|
|
failing since options is an array and not a hash.
|
|
|
|
|
|
|
|
def change
|
|
|
|
change_table :users do |t|
|
|
|
|
t.remove_index [:name, :email]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fix was to check if the options is a Hash before operating on it.
|
|
|
|
|
|
|
|
Fixes #10419.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-02-25 21:06:35 -05:00
|
|
|
* Do not overwrite manually built records during one-to-one nested attribute assignment
|
|
|
|
|
|
|
|
For one-to-one nested associations, if you build the new (in-memory)
|
|
|
|
child object yourself before assignment, then the NestedAttributes
|
|
|
|
module will not overwrite it, e.g.:
|
|
|
|
|
|
|
|
class Member < ActiveRecord::Base
|
|
|
|
has_one :avatar
|
|
|
|
accepts_nested_attributes_for :avatar
|
|
|
|
|
|
|
|
def avatar
|
|
|
|
super || build_avatar(width: 200)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
member = Member.new
|
|
|
|
member.avatar_attributes = {icon: 'sad'}
|
|
|
|
member.avatar.width # => 200
|
|
|
|
|
|
|
|
*Olek Janiszewski*
|
|
|
|
|
2013-05-28 08:34:47 -04:00
|
|
|
* fixes bug introduced by #3329. Now, when autosaving associations,
|
|
|
|
deletions happen before inserts and saves. This prevents a 'duplicate
|
2013-04-10 23:29:19 -04:00
|
|
|
unique value' database error that would occur if a record being created had
|
|
|
|
the same value on a unique indexed field as that of a record being destroyed.
|
|
|
|
|
|
|
|
*Johnny Holton*
|
|
|
|
|
2013-05-01 14:33:11 -04:00
|
|
|
* 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:
|
|
|
|
|
|
|
|
With the model
|
|
|
|
|
|
|
|
class Topic
|
|
|
|
alias_attribute :heading, :title
|
|
|
|
end
|
|
|
|
|
|
|
|
The call
|
|
|
|
|
|
|
|
Topic.where(heading: 'The First Topic')
|
|
|
|
|
|
|
|
should yield the same result as
|
|
|
|
|
|
|
|
Topic.where(title: 'The First Topic')
|
|
|
|
|
|
|
|
This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`.
|
|
|
|
|
|
|
|
This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`.
|
|
|
|
|
|
|
|
*Godfrey Chan*
|
|
|
|
|
2013-04-30 20:24:29 -04:00
|
|
|
* Mute `psql` output when running rake db:schema:load.
|
|
|
|
|
|
|
|
*Godfrey Chan*
|
|
|
|
|
2013-03-07 16:43:00 -05:00
|
|
|
* Trigger a save on `has_one association=(associate)` when the associate contents have changed.
|
|
|
|
|
|
|
|
Fix #8856.
|
|
|
|
|
|
|
|
*Chris Thompson*
|
|
|
|
|
2013-04-30 13:21:23 -04:00
|
|
|
* Abort a rake task when missing db/structure.sql like `db:schema:load` task.
|
|
|
|
|
|
|
|
*kennyj*
|
2013-04-25 20:20:33 -04:00
|
|
|
|
2013-05-02 11:09:59 -04:00
|
|
|
* rake:db:test:prepare falls back to original environment after execution.
|
2013-04-25 20:20:33 -04:00
|
|
|
|
2013-05-02 11:09:59 -04:00
|
|
|
*Slava Markevich*
|
2013-03-23 14:09:53 -04:00
|
|
|
|
2013-04-29 12:06:45 -04:00
|
|
|
Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for previous changes.
|