aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-261-0/+12
| | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* Merge pull request #20552 from jamesdabbs/belongs-to-polymorphic-force-reloadYves Senn2015-06-231-0/+7
|\ | | | | | | Fix `undefined method uncached` for polymorphic belongs_to #20426
* \ Merge pull request #20545 from dcrec1/20541Yves Senn2015-06-231-0/+7
|\ \ | | | | | | | | | thrown ActiveRecord::AssociationTypeMismatch when assigning a wrong value for a namespaced association
| * | thrown ActiveRecord::AssociationTypeMismatch when assigning a wrong value ↵Diego Carrion2015-06-221-0/+7
|/ / | | | | | | | | for a namespaced association fixes #20541
* | AR absence validator respects `marked_for_destruction?`. Closes #20449.Yves Senn2015-06-221-0/+6
| | | | | | | | Associated objects that were marked for destruction are considered absent.
* | Include `Enumerable` in `ActiveRecord::Relation`Sean Griffin2015-06-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | After discussing, we've decided it makes more sense to include it. We're already forwarding every conflicting method to `to_a`, and there's no conflation of concerns. `Enumerable` has no mutating methods, and it just allows us to simplify the code. No existing methods will have a change in behavior. Un-overridden Enumerable methods will simply delegate to `each`. [Sean Griffin & bogdan]
* | Use `Enumerable#sum` on `ActiveRecord::Relation` when a block is givenSean Griffin2015-06-191-0/+4
| | | | | | | | | | | | | | | | This matches our behavior in other cases where useful enumerable methods might have a different definition in `Relation`. Wanting to actually enumerate over the records in this case is completely reasonable, and wanting `.sum` is reasonable for the same reason it is on `Enumerable` in the first place.
* | Merge pull request #19843 from marshall-lee/explain_cte_queriesYves Senn2015-06-191-0/+4
|\ \ | | | | | | | | | | | | | | | | | | Let WITH (CTE) queries be explainable Conflicts: activerecord/CHANGELOG.md
| * | Let WITH (CTE) queries be explainableVladimir Kochnev2015-05-281-0/+4
| | |
* | | make `remove_index :table, :column` reversible.Yves Senn2015-06-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This used to raise a `IrreversibleMigration` error (since #10437). However since `remove_index :table, :column` is probably the most basic use-case we should make it reversible again. Conflicts: activerecord/CHANGELOG.md
* | | quick pass over changelogs. [ci skip]Yves Senn2015-06-151-3/+4
| |/ |/|
* | Don't crash when mutating attributes in a getterSean Griffin2015-06-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | If a getter has side effects on the DB, `changes_applied` will be called twice. The second time will try and remove the changed attributes cache, and will crash because it's already been unset. This also demonstrates that we shouldn't assume that calling getters won't change the value of `changed_attributes`, and we need to clear the cache if an attribute is modified. Fixes #20531.
* | Merge pull request #20226 from EpicH0liday/reversible-remove-foreign-keyYves Senn2015-06-121-0/+5
|\ \ | | | | | | | | | | | | | | | | | | Make remove_foreign_key reversible Conflicts: activerecord/CHANGELOG.md
| * | Add an invert method for remove_foreign_keyAster Ryan2015-06-111-0/+5
| | |
* | | Add enum prefix/suffix option to enum definitionIgor Kapkov2015-06-121-0/+6
|/ / | | | | | | Fixes #17511 and #17415
* | Credit the author of #20515 in the previous commitSean Griffin2015-06-111-1/+1
| | | | | | | | [Sean Griffin & jmondo]
* | Correctly handle array columns with defaults in the schema dumperSean Griffin2015-06-111-0/+6
| | | | | | | | | | | | | | | | | | If the subtype provides custom schema dumping behavior, we need to defer to it. We purposely choose not to handle any values other than an array (which technically should only ever be `nil`, but I'd rather code defensively here). Fixes #20515.
* | Return a `Point` object from the PG Point typeSean Griffin2015-06-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a deprecation cycle to change the behavior of the default point type in the PostgreSQL adapter. The old behavior will continue to be available for the immediate future as `:legacy_point`. The current behavior of returning an `Array` causes several problems, the most significant of which is that we cannot differentiate between an array of points, and a point itself in the case of a column with the `point[]` type. The attributes API gives us a reasonable way to have a proper deprecation cycle for this change, so let's take advantage of it. If we like this change, we can also add proper support for the other geometric types (line, lseg, box, path, polygon, and circle), all of which are just aliases for string today. Fixes #20441
* | minor formatting changes in changelogs. [ci skip]Yves Senn2015-05-311-6/+6
| |
* | Ensure symbols passed to `select` are always quotedSean Griffin2015-05-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our general contract in Active Record is that strings are assumed to be SQL literals, and symbols are assumed to reference a column. If a from clause is given, we shouldn't include the table name, but we should still quote the value as if it were a column. Upon fixing this, the tests were still failing on SQLite. This was because the column name being returned by the query was `"\"join\""` instead of `"join"`. This is actually a bug in SQLite that was fixed a long time ago, but I was using the version of SQLite included by OS X which has this bug. Since I'm guessing this will be a common case for contributors, I also added an explicit check with a more helpful error message. Fixes #20360
* | Add docs and changelog entry for 73aab03 [ci skip]Sean Griffin2015-05-301-0/+5
| |
* | Add CHANGELOG entry for #17654 [ci skip]Ryuta Kamizono2015-05-301-0/+13
|/
* Give credit to extra contributor for Base.reload fixShane Hender2015-05-281-2/+2
|
* Add collation support for string and text columns in SQLite3Akshay Vishnoi2015-05-281-0/+15
|
* Merge pull request #20171 from georgeclaghorn/enums-in-fixturesRafael Mendonça França2015-05-271-0/+9
|\ | | | | | | Allow the use of symbols or strings to specify enum values in test fixtures
| * Resolve enums in test fixturesGeorge Claghorn2015-05-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, values for columns backing Active Record enums must be specified as integers in test fixtures: awdr: title: "Agile Web Development with Rails" status: 2 rfr: title: "Ruby for Rails" status: <%= Book.statuses[:proposed] %> This is potentially confusing, since enum values are typically specified as symbols or strings in application code. To resolve the confusion, this change permits the use of symbols or strings to specify enum values: awdr: status: :published It is compatible with fixtures that specify enum values as integers.
* | Merge pull request #19886 from henders/henders/reload_wipe_query_cacheRafael Mendonça França2015-05-271-0/+4
|\ \ | |/ |/| | | Cause ActiveRecord::Base::reload to also ignore the QueryCache.
* | Merge pull request #20269 from wojobucco/masterRafael Mendonça França2015-05-271-0/+4
|\ \ | | | | | | | | | Changed mysqldump to include sprocs and functions
* | | add `extend` option on `has_and_belongs_to_many`.keepcosmos2015-05-261-0/+4
| | |
* | | deprecate `Relation#uniq` use `Relation#distinct` instead.Yves Senn2015-05-261-0/+6
|/ / | | | | | | | | | | | | | | | | See #9683 for the reasons we switched to `distinct`. Here is the discussion that triggered the actual deprecation #20198. `uniq`, `uniq!` and `uniq_value` are still around. They will be removed in the next minor release after Rails 5.
* | Pass over CHANGELOGS [ci skip]Prathamesh Sonpatki2015-05-161-2/+3
| |
* | Merge branch 'sti-subclass-from-attributes' of ↵Yves Senn2015-05-131-0/+5
|\ \ | | | | | | | | | | | | | | | | | | https://github.com/agrobbin/rails into agrobbin-sti-subclass-from-attributes Conflicts: activerecord/CHANGELOG.md
| * | allow setting of a demodulized class name when using STIAlex Robbin2015-05-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If your STI class looks like this: ```ruby class Company < ActiveRecord::Base self.store_full_sti_class = false class GoodCo < Company end class BadCo < Company end end ``` The expectation (which is valid) is that the `type` in the database is saved as `GoodCo` or `BadCo`. However, another expectation should be that setting `type` to `GoodCo` would correctly instantiate the object as a `Company::GoodCo`. That second expectation is what this should fix.
* | | Add full set of MySQL CLI options to support SSL authentication when using ↵Alex Coomans2015-05-121-0/+6
|/ / | | | | | | db:structure dump and load
* | Merge pull request #19994 from kamipo/dump_indexes_in_create_tableRafael Mendonça França2015-05-031-0/+7
|\ \ | | | | | | | | | Dump indexes in `create_table` instead of `add_index`
| * | Dump indexes in `create_table` instead of `add_index`Ryuta Kamizono2015-05-031-0/+7
| | | | | | | | | | | | | | | If the adapter supports indexes in create table, generated SQL is slightly more efficient.
* | | Merge pull request #17569 from kamipo/dump_table_optionsRafael Mendonça França2015-05-031-0/+4
|\ \ \ | | | | | | | | | | | | Correctly dump `:options` on `create_table` for MySQL
| * | | Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-031-0/+4
| |/ /
* / / PostgreSQL: `:collation` support for string and text columnsRyuta Kamizono2015-05-041-0/+11
|/ / | | | | | | | | | | | | | | | | Example: create_table :foos do |t| t.string :string_en, collation: 'en_US.UTF-8' t.text :text_ja, collation: 'ja_JP.UTF-8' end
* | Improvement on Activerecord CHANGELOGthiagoaugusto2015-05-011-1/+1
| |
* | Merge pull request #19546 from DianthuDia/fix_unscope_for_less_thanYves Senn2015-04-281-0/+4
|\ \ | | | | | | | | | Fix unscope for less than
* \ \ Merge pull request #19718 from eagletmt/find_by-without-argYves Senn2015-04-281-0/+5
|\ \ \ | | | | | | | | | | | | Raise ArgumentError when find_by receives no arguments
* | | | Revert "Merge pull request #17920 from ↵Yves Senn2015-04-271-0/+7
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calebthompson/dont-rely-on-environment-task-for-schema-load" This reverts commit 08ff4ccbbb3fb143a02e6752efb974a4bcfcd3bb, reversing changes made to 6c9ed6dbc62450cdb87559afd15798305e069146. Caused by #17920. Closes #19545. This patch introduced regressions because initializers were no longer loaded. Specifically missing inflections result in broken restores of the database.
* | | Merge pull request #18880 from mudge/timestamp-index-bugRafael Mendonça França2015-04-231-0/+8
|\ \ \ | | | | | | | | | | | | Fix missing index when using timestamps with index
| * | | Fix missing index when using timestamps with indexPaul Mucur2015-04-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `index` option used with `timestamps` should be passed to both `column` definitions for `created_at` and `updated_at` rather than just the first. This was happening because `Hash#delete` is used to extract the `index` option passed to `timestamps`, thereby mutating the `options` hash in-place. Now take a copy of the `options` before deleting so that the original is not modified.
* | | | pass over CHANGELOGs. [ci skip]Yves Senn2015-04-221-4/+6
| | | |
* | | | Rename association option :class to :anonymous_classAndrew White2015-04-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 1f006c an option was added called :class to allow passing anonymous classes to association definitions. Since using :class instead of :class_name is a fairly common typo even amongst experienced developers this can result in hard to debug errors arising in raise_on_type_mismatch? To fix this we're renaming the option from :class to :anonymous_class as that is a more correct description of what the option is for. Since this was an internal, undocumented option there is no need for a deprecation. Fixes #19659
* | | | Autosave existing records on HMT associations when the parent is newSean Griffin2015-04-181-0/+7
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To me it seems like this should only be the case if `autosave: true` is set on the association. However, when implemented that way, it caused issues with has many associations, where we have explicit tests stating that child records are updated when the parent is new, even if autosave is not set (presumably to update the parent id, but other changed attributes would be persisted as well). It's quirky, but at least we should be consistently quirky. This constitutes a minor but subtle change in behavior, and therefore should not be backported to 4.2 and earlier. Fixes #19782
* | | Revert "Merge pull request #19755 from yuki24/activerecord/support-for-set"Yves Senn2015-04-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 524d40591eaa2f4d007409bfad386f6b107492eb, reversing changes made to 34d3a6095100245283861ef480a54d0643bbee4c. Reasoning behind the revert are in the PR discussion: https://github.com/rails/rails/pull/19755 - This means that types can no longer cast to/from `Set`, and reasonably work with `where` (we already have this problem for `array`/`json` types on pg) - This adds precedent for every other `Enumerable`, and we can't target `Enumerable` directly. - Calling `to_a` on a `Set` is reasonable.
* | | Merge pull request #19755 from yuki24/activerecord/support-for-setYves Senn2015-04-141-0/+4
|\ \ \ | |/ / |/| | | | | Add support for Set to Relation#where