aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | add `:index_errors` option to example [ci skip]yuuji.yaginuma2016-03-271-2/+2
| | | | |
* | | | | Memoize user provided defaults before type castingSean Griffin2016-03-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a proc is given as a default value, the form builder ends up displaying `Proc#to_s` when the default is used. That's because we didn't handle the proc until type casting. This issue technically can occur any time that a proc is the value before type casting, but in reality the only place that will occur is when a proc default is provided through the attributes API, so the best place to handle this edge case is there. I've opted to memoize instead of just moving the `Proc#call` up, as this made me realize that it could potentially interact very poorly with dirty checking. The code here is a little redundant, but I don't want to rely on how `value_before_type_cast` is implemented in the super class, even if it's just an `attr_reader`. Fixes #24249 Close #24306
* | | | | Merge pull request #24167 from ↵Jeremy Daer2016-03-231-0/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/append_sql_mode_instead_of_overwriting_in_strict_mode Append sql_mode instead of overwriting in strict mode
* | | | | guides, sync 5.0 release notes with changelogsYves Senn2016-03-221-1/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip] Sync AV, AR, AJ, AS, AM changelogs with our 5.0 release notes draft. This is a follow up to c94045d and contains changes made since the release of beta1.
* | | | Execute default_scope defined by abstract class within the scope of subclassMehmet Emin İNAÇ2016-03-081-0/+6
| | | |
* | | | Add changelog for batch touch records.Arthur Neves2016-03-071-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | related to #19324 and #18606 [skip ci]
* | | | move changelog to right place [skip ci]Arthur Neves2016-03-071-6/+6
| | | |
* | | | Add changelog for #20997Arthur Neves2016-03-071-0/+6
| | | |
* | | | don't treat all associations with extensions as instance dependent.Yves Senn2016-03-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #23934. This is a forward port of ac832a43b4d026dbad28fed196d2de69ec9928ac Previously the scope of all associations with extensions were wrapped in an instance dependent proc. This made it impossible to preload such associations.
* | | | Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`Ryuta Kamizono2016-03-021-1/+5
| | | | | | | | | | | | | | | | | | | | Originally, `{insert|update|delete}_sql` is protected methods. We can use the `{insert|update|delete}` public methods instead.
* | | | Merge pull request #23417 from sgringwe/masterRafael Mendonça França2016-03-011-0/+6
|\ \ \ \ | | | | | | | | | | | | | | | Add option to error on ignored order or limit
| * | | | Add initial support for allowing an error on order or limit of queries being ↵Scott Ringwelski2016-02-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ignored in batches add some documentation and add 4 tests regarding error vs. warning behavior fix a typo when referring to the message go back to default in tests so that ordering is not important. use a constant instead of method. fix assert_nothing_raised call. use self.klass to allow per class configuration remove logger warn assets as that is tested elsewhere. pass error_on_ignore through find_each and find_in_batches also. add blocks to the finds so that the code is actually executed put the setting back to default in an ensure Add a changelog entry
* | | | | Merge pull request #18766 from yasyf/issue_17864Sean Griffin2016-02-291-0/+15
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Honour joining model order in `has_many :through` associations when eager loading
| * | | | | Honour the order of the joining model in a `has_many :through`Yasyf Mohamedali2015-03-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | association when eager loading. Previously, eager loading a `has_many :through` association with no defined order would return the records in the natural order of the database. Now, these records will be returned in the order that the joining record is returned, in case there is a defined order there.
* | | | | | Ensure suppressor runs before validationseileencodes2016-02-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I ran into an issue where validations on a suppressed record were causing validation errors to be thrown on a record that was never going to be saved. There isn't a reason to run the validations on a record that doesn't matter. This change moves the suppressor up the chain to be run on the `save` or `save!` in the validations rather than in persistence. The issue with running it when we hit persistence is that the validations are run first, then we hit persistance, and then we hit the suppressor. The suppressor comes first. The change to the test was required since I added the `validates_presence_of` validations. Adding this alone was enough to demonstrate the issue. I added a new test to demonstrate the new behavior is explict.
* | | | | | Preparing for 5.0.0.beta3 releaseeileencodes2016-02-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Adds changelog headers for beta3 release
* | | | | | Remove changelog entry for reverted commiteileencodes2016-02-241-12/+0
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | I had to revert changes made for this CHANGELOG entry so this is no longer valid. The change for this entry was removed in 2c02bc0.
* | | | | Merge pull request #23794 from matthewd/mutation-safe-to_aMatthew Draper2016-02-211-0/+8
| | | | | | | | | | | | | | | | | | | | Mutating the result of Relation#to_a should not affect the relation
* | | | | Add accidentally removed `#` [ci skip]Ryuta Kamizono2016-02-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | `#` was removed at f57092a but this `#` is intentional. e.g. https://github.com/rails/rails/blame/v5.0.0.beta2/activerecord/CHANGELOG.md#L1423-L1426
* | | | | Fix indentation for code block in changelogEileen M. Uchitelle2016-02-171-4/+4
| | | | | | | | | | | | | | | This was showing up as an H1. Fixing the indentation here fixes the codeblock.
* | | | | Remove accidentally duplicated change log title [ci skip]Mehmet Emin İNAÇ2016-02-181-3/+0
| | | | |
* | | | | Fixed `where` for polymorphic associations when passed an array containing ↵Philippe Huibonhoa2016-02-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | different types. When passing in an array of different types of objects to `where`, it would only take into account the class of the first object in the array. PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)]) # => SELECT "price_estimates".* FROM "price_estimates" WHERE ("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" IN (1, 2)) This is fixed to properly look for any records matching both type and id: PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)]) # => SELECT "price_estimates".* FROM "price_estimates" WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1) OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
* | | | | Merge pull request #23614 from georgemillo/foreign_keyYves Senn2016-02-161-0/+5
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let t.foreign_key use the same `to_table` twice Conflicts: activerecord/CHANGELOG.md
| * | | | | Let t.foreign_key use the same `to_table` twiceGeorge Millo2016-02-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously if you used `t.foreign_key` twice within the same `create_table` block using the same `to_table`, all statements except the final one would fail silently. For example, the following code: def change create_table :flights do |t| t.integer :from_id, index: true, null: false t.integer :to_id, index: true, null: false t.foreign_key :airports, column: :from_id t.foreign_key :airports, column: :to_id end end Would only create one foreign key, on the column `from_id`. This commit allows multiple foreign keys to the same table to be created within one `create_table` block.
* | | | | | Merge pull request #23706 from vipulnsward/add-changelog-for-regressionYves Senn2016-02-161-2/+9
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | Add missing CHANGELOG for regression fix in #18155 which fixes #13387
| * | | | | Add missing CHANGELOG for regression fix in #18155 which fixes #13387Vipul A M2016-02-161-0/+7
|/ / / / / | | | | | | | | | | | | | | | [ci skip]
* | | | | Merge pull request #23377 from bogdan/last-with-sqlEileen M. Uchitelle2016-02-131-0/+21
|\ \ \ \ \ | | | | | | | | | | | | Fix AR::Relation#last bugs instroduced in 7705fc
| * | | | | Make ActiveRecord::Relation#last to reverse SQL orderBogdan Gusiev2016-02-131-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | instead of loading the relation into memory
* | | | | | Add the missing author name [ci skip]Ryuta Kamizono2016-02-131-0/+2
|/ / / / / | | | | | | | | | | | | | | | The author name was lost in the merge commit 6fedc7d.
* | | | / use rails instead of rakeGaurav Sharma2016-02-121-1/+1
| |_|_|/ |/| | | | | | | since starting with Rails 5.x(beta) we prefer to use rails as the replacement of rake commands, may be change log will be the same
* | | | Merge pull request #18109 from k0kubun/unscoped-joinsSean Griffin2016-02-111-0/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Allow `joins` to be unscoped Fixes #13775
| * | | | Allow `joins` to be unscopedTakashi Kokubun2016-01-311-0/+6
| | | | |
* | | | | include activerecord and activesupport CHANGELOG entriesBrian Christian2016-02-101-0/+4
| | | | |
* | | | | Merge pull request #23508 from meinac/add_numeric_type_into_migrationsSean Griffin2016-02-071-0/+10
|\ \ \ \ \ | |_|_|_|/ |/| | | | Added numeric helper into `SchemaStatements` for MySQL and PostgreSQL
| * | | | Added numeric helper into migrations.Mehmet Emin İNAÇ2016-02-071-0/+10
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this addition, you can add a column into the table like: ``` create_table(:numeric_types) do |t| t.numeric :foo, precision: 10, scale: 2, default: 2.0 end ``` The result of the migration above is same with: ``` create_table(:numeric_types) do |t| t.decimal :foo, precision: 10, scale: 2, default: 2.0 end ```
* / | | Revert "Dump indexes in `create_table` instead of `add_index`"Sean Griffin2016-02-051-7/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 99801c6a7b69eb4b006a55de17ada78f3a0fa4c1. Ultimately it doesn't matter whether `add_index` or `t.index` are used in the schema dumper in any meaningful way. There are gems out there which hook into the old behavior for things like indexing materialized views. Since the reverted commit doesn't seem to add much benefit, there's no reason for us to break these gems.
* | | The minimum supported version of PostgreSQL is now >= 9.1Remo Mueller2016-02-021-0/+6
| | |
* | | Add some Action Cable CHANGELOG entriesRafael Mendonça França2016-02-011-3/+0
| | | | | | | | | | | | | | | | | | And improve changelongs. [ci skip]
* | | Preparing for Rails 5.0.0.beta2Sean Griffin2016-02-011-0/+5
| | |
* | | Revert "Merge pull request #16400 from bogdan/last-with-sql"Sean Griffin2016-02-011-20/+0
|/ / | | | | | | | | | | | | | | | | | | This reverts commit 9f3730a516f30beb0050caea9539f8d6b808e58a, reversing changes made to 2637fb75d82e1c69333855abd58c2470994995d3. There are additional issues with this commit that need to be addressed before this change is ready (see #23377). This is a temporary revert in order for us to have more time to address the issues with that PR, without blocking the release of beta2.
* | Reworked ActiveRecord::Relation#last to always use SQLBogdan Gusiev2016-01-281-0/+20
| | | | | | | | instead of loading relation
* | Introduce ActiveRecord::IrreversibleOrderErrorBogdan Gusiev2016-01-271-0/+14
| | | | | | | | | | Raises when #reverse_order can not process SQL order instead of making invalid SQL before this patch
* | INSERT INTO schema_migrations in 1 SQLAkira Matsuda & Naoto Koshikawa2016-01-271-0/+5
| | | | | | | | | | | | | | We found that inserting all 600 schema_migrations for our mid-sized app takes about a minute on a cloud based CI environment. I assume that the original code did not use multi-row-insert because SQLite3 was not supporting the syntax back then, but it's been supported since 3.7.11: http://www.sqlite.org/releaselog/3_7_11.html
* | Pare back default `index` option for the migration generatorPrathamesh Sonpatki2016-01-241-0/+9
| | | | | | | | | | | | | | | | | | | | - Using `references` or `belongs_to` in migrations will always add index for the referenced column by default, without adding `index:true` option to generated migration file. - Users can opt out of this by passing `index: false`. - Legacy migrations won't be affected by this change. They will continue to run as they were before. - Fixes #18146
* | Update CHANEGLOG for https://github.com/rails/rails/pull/20005 [ci skip]Prathamesh Sonpatki2016-01-201-1/+5
| |
* | run `type` column through attribtues API type casting.Yves Senn2016-01-191-0/+8
| | | | | | | | | | | | | | Closes #21986. This makes it possible to write custom types that define a different mapping for STI columns.
* | Changed options for find_each and variants to have options start/finish ↵Vipul A M2016-01-181-2/+2
| | | | | | | | | | | | instead of start_at/end_at based on comments at https://github.com/rails/rails/pull/12257#issuecomment-74688344
* | Merge pull request #20005 from kamipo/default_expression_supportRafael França2016-01-161-0/+10
|\ \ | | | | | | Add `:expression` option support on the schema default
| * | Add expression support on the schema defaultRyuta Kamizono2016-01-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :posts do |t| t.datetime :published_at, default: -> { 'NOW()' } end
* | | Revert "Merge pull request #20835 from ↵Kasper Timm Hansen2016-01-141-4/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | glittershark/if-and-unless-in-secure-token" This reverts commit 224eddfc0eeff6555ae88691306e61c7a9e8b758, reversing changes made to 9d681fc74c6251d5f2b93fa9576c9b2113116680. When merging the pull request, I misunderstood `has_secure_token` as declaring a model has a token from birth and through the rest of its lifetime. Therefore, supporting conditional creation doesn't make sense. You should never mark a model as having a secure token if there's a time when it shouldn't have it on creation.