aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | AR specific length validator to respect `marked_for_destruction`.Yves Senn2014-12-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #7247. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/owner.rb
* | | | | | | Ensure `first!` and friends work on loaded associationsSean Griffin2014-12-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #18237
* | | | | | | `eager_load` preserves readonly flag for associationsTakashi Kokubun2014-12-301-0/+6
| |_|_|/ / / |/| | | | |
* | | | | | docs, cleanup Active Record CHANGELOG. [ci skip]Yves Senn2014-12-281-4/+4
| | | | | |
* | | | | | Provide :touch option to save() to accommodate saving without updating ↵Dan Olson2014-12-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | timestamps. [#18202]
* | | | | | Provide a better error message for unsupported classes in `serialize`Sean Griffin2014-12-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only support classes which provide a no-args constructor to use as a default value. We can provide a more helpful error message if we catch this when `serialize` is called, rather than letting it error when you try to assign the attribute. Fixes #18224
* | | | | | Add bigint primary key support for MySQL.Ryuta Kamizono2014-12-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :foos, id: :bigint do |t| end
* | | | | | Support for any type primary key.Ryuta Kamizono2014-12-281-0/+6
| | | | | |
* | | | | | Dump the default `nil` for PostgreSQL UUID primary key.Ryuta Kamizono2014-12-261-0/+4
| | | | | |
* | | | | | Changelog for 99a6f9e60ea55924b44f894a16f8de0162cf2702Sean Griffin2014-12-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Here you go, @senny. :grin:
* | | | | | Merge Pull Request #18157Sean Griffin2014-12-231-0/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG.md
| * | | | | | Don't raise on out-of-range datetimes passed by a userGrey Baker2014-12-231-0/+5
| | |/ / / / | |/| | | |
* | | | | | Replace deprecated `#load_schema` with `#load_schema_for`.Yves Senn2014-12-231-0/+5
| | | | | |
* | | | | | cleanup CHANGELOGs. [ci skip]Yves Senn2014-12-231-2/+2
| | | | | |
* | | | | | Fixing numeric attrs when set to same negative valueDaniel Fox2014-12-231-0/+7
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug occurs when an attribute of an ActiveRecord model is an ActiveRecord::Type::Integer type or a ActiveRecord::Type::Decimal type (or any other type that includes the ActiveRecord::Type::Numeric module. When the value of the attribute is negative and is set to the same negative value, it is marked as changed. Take the following example of a Person model with the integer attribute age: class Person < ActiveRecord::Base # age :integer(4) end The following will produce the error: person = Person.new(age: -1) person.age = -1 person.changes => { "age" => [-1, -1] } person.age_changed? => true The problematic line is here: module ActiveRecord module Type module Numeric ... def non_numeric_string?(value) # 'wibble'.to_i will give zero, we want to make sure # that we aren't marking int zero to string zero as # changed. value.to_s !~ /\A\d+\.?\d*\z/ end end end end The regex match doesn't accept numbers with a leading '-'.
* | | | | `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-0/+7
| | | | |
* | | | | `db:structure:load` and `db:schema:load` no longer purge the database.Yves Senn2014-12-181-0/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #17945 `db:test:prepare` still purges the database to always keep the test database in a consistent state. This patch introduces new problems with `db:schema:load`. Prior to the introduction of foreign-keys, we could run this file against a non-empty database. Since every `create_table` containted the `force: true` option, this would recreate tables when loading the schema. However with foreign-keys in place, `force: true` wont work anymore and the task will crash. /cc @schneems
* | | | Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.Ryuta Kamizono2014-12-121-0/+4
| | | |
* | | | Add foreign_type option for polymorphic has_one and has_many.Ulisses Almeida + Kassio Borges2014-12-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To be possible to use a custom column name to save/read the polymorphic associated type in a has_many or has_one polymorphic association, now users can use the option :foreign_type to inform in what column the associated object type will be saved.
* | | | Remove deprecated behavior allowing nested arrays as query valuesMelanie Gilman2014-12-041-0/+5
| | | |
* | | | Deprecate `Class` handler in `PredicateBuilder`Melanie Gilman2014-12-041-0/+5
| | | | | | | | | | | | | | | | Users should pass strings to queries instead of classes
* | | | Active Record changelog needs to keep pointing at 4-2-stable. #17651Yves Senn2014-12-031-1/+1
| | | | | | | | | | | | | | | | [ci skp]
* | | | docs, add new changelog entries at the top :sweat: [ci skip] #17651Yves Senn2014-12-031-5/+5
| | | |
* | | | Failure to rollback t.timestamps when within a change_table migrationnoam2014-12-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running the following migration: change_table(:table_name) { |t| t/timestamps } The following error was produced: wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps' This is due to `arguments` containing an empty hash as its second argument.
* | | | no need to pass native_database_types aroundYves Senn2014-12-021-0/+7
| | | |
* | | | Start Rails 5 development :tada:Rafael Mendonça França2014-11-281-1336/+1
| |_|/ |/| | | | | | | | | | | | | | | | | We will support only Ruby >= 2.1. But right now we don't accept pull requests with syntax changes to drop support to Ruby 1.9.
* | | Active Record change log pass [skip ci]Jon Atack2014-11-261-38/+40
| | |
* | | bring back `db:test:prepare`.Yves Senn2014-11-251-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts deprecations added in #13528. The task is brought back for two reasons: 1. Give plugins a way to hook into the test database initialization process 2. Give the user a way to force a test database synchronization While `test:prepare` is still a dependency of every test task, `db:test:prepare` no longer hooks into it. This means that `test:prepare` runs before the schema is synchronized. Plugins, which insert data can now hook into `db:test:prepare`. The automatic schema maintenance can't detect when a migration is rolled-back, modified and reapplied. In this case the user has to fall back to `db:test:prepare` to force the synchronization to happen.
* | | Merge pull request #17678 from siddharth28/includes_with_scope_with_joinsSantiago Pastorino2014-11-241-0/+6
|\ \ \ | | | | | | | | Fix includes on association with a scope
| * | | Fix includes on association with a scope containing joins along with conditionssiddharth@vinsol.com2014-11-211-0/+6
| | | | | | | | | | | | | | | | on the joined assoiciation
* | | | Add changelog entry for .reflections API changeArthur Neves2014-11-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `.reflections` public API changed to return a String instead of a Symbol as keys. see commit 1f31488499111fdfce79d8dc1cc8fb008f7cdb25 and 6259e4e2dcca9a79f22f96658c33efe81936bc0d [fixes #16928] [fixes #17610]
* | | | Rename the primary key index when renaming a table in pgSean Griffin2014-11-221-0/+6
|/ / / | | | | | | | | | | | | | | | | | | | | | Also checked to make sure this does not affect foreign key constraints. (It doesn't). Fixes #12856 Closes #14088
* | | make it possible to access fixtures excluded by a `default_scope`.Yves Senn2014-11-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch you'd end up with an error like: ``` ActiveRecord::RecordNotFound: Couldn't find <Model> with 'id'=<id> [WHERE (<default_scope condition>)] ```
* | | Merge pull request #17580 from ccutrer/change_table_nameYves Senn2014-11-111-0/+4
|\ \ \ | | | | | | | | | | | | add a Table#name accessor like TableDefinition#name
| * | | add a Table#name accessor like TableDefinition#nameCody Cutrer2014-11-101-0/+4
|/ / /
* | | Merge pull request #11694 from ↵Rafael Mendonça França2014-11-101-0/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Empact/association-bind-values-not-updated-on-save Fix that a collection proxy could be cached before the save of the owner, resulting in an invalid proxy lacking the owner’s id Conflicts: activerecord/CHANGELOG.md
| * | | Fix that a collection proxy could be cached before the save of the owner, ↵Ben Woosley2014-10-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | resulting in an invalid proxy lacking the owner’s id. Absent this fix calls like: owner.association.update_all to behave unexpectedly because they try to act on association objects where owner_id is null. more evidence here: https://gist.github.com/Empact/5865555 ``` Active Record 3.2.13 -- create_table(:firms, {:force=>true}) -> 0.1371s -- create_table(:clients, {:force=>true}) -> 0.0005s 1 clients. 1 expected. 1 clients updated. 1 expected. ``` ``` Active Record 4.0.0 -- create_table(:firms, {:force=>true}) -> 0.1606s -- create_table(:clients, {:force=>true}) -> 0.0004s 1 clients. 1 expected. 0 clients updated. 1 expected. ```
* | | | Merge pull request #17541 from OpenSourceProjects/meaninful_messageYves Senn2014-11-071-0/+4
| | | | | | | | | | | | | | | | Print out a meaningful error when ActiveRecord::ReadOnlyRecord is raised
* | | | Merge pull request #17360 from bronzle/includes_and_unscopedYves Senn2014-11-051-0/+6
|\ \ \ \ | | | | | | | | | | | | | | | copy reflection_scopes’s unscoped value when building scope for preloading
* | | | | Added SchemaDumper support for tables with jsonb columns.Ted O'Meara2014-11-041-0/+4
| | | | |
* | | | | Revert deprecation of `sanitize_sql_hash_for_assignment`Sean Griffin2014-11-021-3/+2
| | | | | | | | | | | | | | | | | | | | This method is still used by `update_all`
* | | | | Deprecate `sanitize_sql_hash_` methods on ActiveRecordSean Griffin2014-11-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | These appear to be implementation relics of times past. They duplicate the logic in Relation, and are no longer used internally.
* | | | | Use bind values for joined tables in where statementsSean Griffin2014-11-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practical terms, this allows serialized columns and tz aware columns to be used in wheres that go through joins, where they previously would not behave correctly. Internally, this removes 1/3 of the cases where we rely on Arel to perform type casting for us. There were two non-obvious changes required for this. `update_all` on relation was merging its bind values with arel's in the wrong order. Additionally, through associations were assuming there would be no bind parameters in the preloader (presumably because the where would always be part of a join) [Melanie Gilman & Sean Griffin]
* | | | | fix MySQL enum type lookup with values matching another type. Closes #17402.Yves Senn2014-10-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MySQLAdapter type map used the lowest priority for enum types. This was the result of a recent refactoring and lead to some broken lookups for enums with values that match other types. Like `8bit`. This patch restores the priority to what we had before the refactoring. /cc @sgrif
* | | | | Merge pull request #17374 from maurogeorge/scope-exceptionYves Senn2014-10-271-0/+4
|\| | | | | | | | | | | | | | | | | | | Raises ArgumentError when try to define a scope without a callable
* | | | | Merge pull request #14143 from derekprior/dp-compound-index-orderingYves Senn2014-10-271-0/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use type column first in multi-column indexes Conflicts: activerecord/CHANGELOG.md
| * | | | | Use type column first in multi-column indexesDerek Prior2014-10-241-0/+4
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `add_reference` can very helpfully add a multi-column index when you use it to add a polymorphic reference. However, the first column in the index is the `id` column, which is less than ideal. The [PostgreSQL docs][1] say: > A multicolumn B-tree index can be used with query conditions that > involve any subset of the index's columns, but the index is most > efficient when there are constraints on the leading (leftmost) > columns. The [MySQL docs][2] say: > MySQL can use multiple-column indexes for queries that test all the > columns in the index, or queries that test just the first column, the > first two columns, the first three columns, and so on. If you specify > the columns in the right order in the index definition, a single > composite index can speed up several kinds of queries on the same > table. In a polymorphic relationship, the type column is much more likely to be useful as the first column in an index than the id column. That is, I'm more likely to query on type without an id than I am to query on id without a type. [1]: http://www.postgresql.org/docs/9.3/static/indexes-multicolumn.html [2]: http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html
* / / / / Fix Relation.rewhere to work with Range valuesDan Olson2014-10-201-0/+4
|/ / / /
* | | | Merge pull request #17019 from yuki24/add-class-name-to-unknown-attr-errorYves Senn2014-10-201-4/+1
|\ \ \ \ | | | | | | | | | | | | | | | Message on AR::UnknownAttributeError should include the class name of a record
| * | | | AR::UnknownAttributeError should include the class name of a recordYuki Nishijima2014-10-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This would be helpful if 2 models have an attribute that has a similar name to the other. e.g: before: User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"]) # => ActiveRecord::UnknownAttributeError: unknown attribute: name after: User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"]) # => ActiveRecord::UnknownAttributeError: unknown attribute on User: name