aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Point master changelogs to 4-1-stable branchCarlos Antonio da Silva2014-02-251-1858/+1
| | | | Remove 4-1 related entries from master [ci skip]
* Coerce strings when reading attributes.Yves Senn2014-02-231-0/+11
|
* deprecate support for pg ranges with excluding beginnings.Yves Senn2014-02-231-0/+11
| | | | | | | | | | | | | | | The Ruby Range object does not support excluding beginnings. We currently support excluding beginnings for some subtypes using manually by incrementing them (now using the `#succ` method). This is approach is flawed as it's not equal to an excluding beginning. This commit deprecates the current support for excluding beginnings. It also raises an `ArgumentError` for subtypes that do not implement the `succ` method. This is a temporary solution to get rid of the broken state. We might still add complete support for excluding beginnings afterwards. (Probably with a new `PGRange` object, which acts like a `Range` but has excluding beginnings.
* dynamically define PostgreSQL OID range types.Yves Senn2014-02-231-0/+4
| | | | | | | | This gets AR working with custom defined range types. It also removes the need for subtype specific branches in `OID::Range`. This expands the interface of all `OID` types with the `infinity` method. It's responsible to provide a value for positive and negative infinity.
* Typo fix for unscopeAmit Thawait2014-02-181-1/+1
|
* Merge branch '4-1-0-beta2'Rafael Mendonça França2014-02-181-0/+4
|\ | | | | | | | | | | Conflicts: actionview/CHANGELOG.md activerecord/CHANGELOG.md
| * Preparing for 4.1.0.beta2 releaseRafael Mendonça França2014-02-181-0/+4
| |
* | Don't use `# =>` when it is not the expression valuesRafael Mendonça França2014-02-181-9/+9
| | | | | | | | [ci skip]
* | Fix the column name [ci skip]Rafael Mendonça França2014-02-181-6/+6
| |
* | Document the default scopes change on the release notes, CHANGELOGRafael Mendonça França2014-02-181-0/+61
| | | | | | | | | | | | and upgrating guides [ci skip]
* | Revert "Merge pull request #13344 from ccutrer/fix-from-default-select"Rafael Mendonça França2014-02-171-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3ea840355409dc205a9e0d027fc09f1452636969, reversing changes made to e4cde5d58cbb09d1843796f96ba86225ff94fe05. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/query_methods.rb Reason: using `from` without `select` should not change the select list to SELECT * because it can lead different query results. If it is needed to change the table to a subquery or a view you can pass a table alias in the `from` call or use `select('subquery.*')`. Fixes #14049.
* | Fix typo [ci skip]Rafael Mendonça França2014-02-161-1/+1
| |
* | Resolve encoding issues with arrays of hstore (bug 11135).Josh Goodall2014-02-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't have enough encoding for the wire protocol to store an array of hstore types. So, further encode any hstore that is an array member. Whilst we're here, ensure it's an HashWithIndifferentAccess being returned, to be consistent with other serialized forms, and add testing for arrays of hstore. So now the following migration: enable_extension "hstore" create_table :servers do |t| t.string :name t.hstore :interfaces, array: true end produces a model that can used like this, to store an array of hashes: server = Server.create(name: "server01", interfaces: [ { name: "bge0", ipv4: "192.0.2.2", state: "up" }, { name: "de0", state: "disabled", by: "misha" }, { name: "fe0", state: "up" }, ]) More at http://inopinatus.org/2013/07/12/using-arrays-of-hstore-with-rails-4/
* | Add a missing changelog entry for #13981 and #14035Robin Dupret2014-02-151-0/+7
| | | | | | | | [ci skip]
* | Drop the correct index after reverting a migrationHubert Dąbrowski2014-02-131-0/+12
| | | | | | | | | | | | Previously when reverting a migration which added a named index it would instead drop a corresponding index with matching columns but without a name.
* | Merge branch 'dump-schema-after-migration-flag' of ↵Xavier Noria2014-02-061-0/+8
|\ \ | | | | | | | | | | | | | | | | | | git://github.com/emilsoman/rails into emilsoman-dump-schema-after-migration-flag Conflicts: activerecord/CHANGELOG.md
| * | Add config to disable schema dump after migrationEmil Soman2014-02-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a config on Active Record named `dump_schema_after_migration` * Schema dump doesn't happen if the config is set to false * Set default value of the config to true * Set config in generated production environment file to false * Update configuration guide * Update CHANGELOG
* | | synchronize 4.1 release notes with CHANGELOGS. [ci skip]Yves Senn2014-02-061-9/+13
| | | | | | | | | | | | /cc @chancancode
* | | Return sized enumerator from Enumerable#index_byMarc-Andre Lafortune2014-02-051-6/+1
| | |
* | | Return sized enumerator from Batches#find_eachMarc-Andre Lafortune2014-02-051-1/+7
| | |
* | | Return sized enumerator from Batches#find_in_batchesMarc-Andre Lafortune2014-02-051-0/+6
|/ /
* | Add CHANGELOG entry for #13935 [ci skip]Rafael Mendonça França2014-02-041-0/+9
| |
* | some wording format changes. [ci skip]Yves Senn2014-02-031-5/+5
| |
* | pass `habtm :autosave` to underlying `hm:t` association. Closes #13923.Yves Senn2014-02-031-0/+7
| |
* | Merge pull request #13688 from jbaudanza/psql-index-existsRafael Mendonça França2014-02-011-0/+10
|\ \ | | | | | | | | | | | | | | | | | | PostgreSQL implementation of SchemaStatements#index_name_exists? Conflicts: activerecord/CHANGELOG.md
| * | psql implementation of #index_name_exists?Jonathan Baudanza2014-01-161-0/+10
| | |
* | | Fixes issue with parsing whitespace content back from database - fixes #13907Mauricio Linhares2014-02-011-0/+11
| | |
* | | Minor changelog improvements [ci skip]Carlos Antonio da Silva2014-01-311-4/+4
| | |
* | | Associations now raise `ArgumentError` on name conflicts.Lauro Caetano2014-01-311-0/+16
| | | | | | | | | | | | | | | Dangerous association names conflicts include instance or class methods already defined by `ActiveRecord::Base`.
* | | Fix regression on `.select_*` methods.Arthur Neves2014-01-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelation, which has the bind information, so we can use that to get the right sql query. Also fix select_rows on postgress and sqlite3 that were not using the binds [fixes #7538] [fixes #12017] [related #13731] [related #12056]
* | | AestheticRafael Mendonça França2014-01-291-1/+1
| | |
* | | Fixing issue with activerecord serialization not being able to dump a record ↵Mauricio Linhares2014-01-291-0/+12
| | | | | | | | | | | | after loading it from YAML - fixes #13861
* | | Merge pull request #13201 from marcandre/find_in_batch_enumeratorRafael Mendonça França2014-01-291-0/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | `find_in_batches` now returns an `Enumerator` Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/batches.rb
| * | | `find_in_batches` now returns an `Enumerator` when called without a block, ↵Marc-Andre Lafortune2013-12-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | so that it can be chained with other `Enumerable` methods.
* | | | `enum` now raises on "dangerous" name conflictsGodfrey Chan2014-01-291-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dangerous name conflicts includes instance or class method conflicts with methods defined within `ActiveRecord::Base` but not its ancestors, as well as conflicts with methods generated by other enums on the same class. Fixes #13389.
* | | | `scope` now raises on "dangerous" name conflictsGodfrey Chan2014-01-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to dangerous attribute methods, a scope name conflict is dangerous if it conflicts with an existing class method defined within `ActiveRecord::Base` but not its ancestors. See also #13389. *Godfrey Chan*, *Philippe Creux*
* | | | Correctly send the string given to lock! and reload(:lock) to the lock scope ↵Mauricio Linhares2014-01-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | - fixes #13788 As per the documentation at lock!, if the :lock option is a string it should use the given SQL to generate the lock statement.
* | | | Handle aliased attributes in AR::Relation#select, #order, etc.Tsutomu Kuroda2014-01-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With this we can write `Model#select(:aliased)`, `Model#order(:aliased)`, `Model#reoder(aliased: :desc)`, etc. Supplementary work to 54122067acaad39b277a5363c6d11d6804c7bf6b.
* | | | Improve the CHANGELOG entry [ci skip]Rafael Mendonça França2014-01-221-2/+14
| | | |
* | | | Calling reset on a collection association should unload the assocationKelsey Schlarman2014-01-211-0/+6
| | | | | | | | | | | | | | | | Need to define #reset on CollectionProxy.
* | | | Merge pull request #13776 from rails/dirty-enumRafael Mendonça França2014-01-211-0/+18
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the Dirty API with the Enum feature correctly. Conflicts: activerecord/CHANGELOG.md
| * | | | Make enum feature work with dirty methodsRafael Mendonça França2014-01-211-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | To make this possible we have to override the save_changed_attribute hook.
* | | | | `has_one` and `belongs_to` accessors don't add ORDER BY to the queries anymore.Rafael Mendonça França2014-01-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent results among different database engines. But for singular associations this behavior is not needed since we will have one record to return. As this ORDER BY option can lead some performance issues we are removing it for singular associations accessors. Fixes #12623.
* | | | | prepend table name for `Relation#select` columns.Yves Senn2014-01-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug where `select(:id)` combined with `joins()` raised: ``` ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: id: SELECT id, authors.author_address_id FROM "posts" INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" ORDER BY posts.id LIMIT 3 ``` The `select_values` are still String and Symbols because other parts (mainly calculations.rb) rely on that fact. /cc @tenderlove
* | | | | Active Record changelog wording and formatting. [ci skip]Yves Senn2014-01-211-5/+6
| | | | |
* | | | | Fail early with "Primary key not included in the custom select clause" in ↵Alexander Balashov2014-01-211-0/+8
|/ / / / | | | | | | | | | | | | | | | | find_in_batches Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
* | | | Ensure #second acts like #first AR finderJason Meller2014-01-201-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit bring the famous ordinal Array instance methods defined in ActiveSupport into ActiveRecord as fully-fledged finders. These finders ensure a default ascending order of the table's primary key, and utilize the OFFSET SQL verb to locate the user's desired record. If an offset is defined in the query, calling #second adds to the offset to get the actual desired record. Fixes #13743.
* | | | Restore ActiveRecord states after a rollback for models w/o callbacksGodfrey Chan2014-01-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression (#13744) that was caused by 67d8bb9. In 67d8bb9, we introduced lazy rollback for records, such that the record's internal states and attributes are not restored immediately after a transaction rollback, but deferred until they are first accessed. This optimization is only performed when the model does not have any transactional callbacks (e.g. `after_commit` and `after_create`). Unfortunately, the models used to test the affected codepaths all comes with some sort of transactional callbacks. Therefore this codepath remains largely untested until now and as a result there are a few issues in the implementation that remains hidden until now. First, the `sync_with_transaction_state` (or more accurately, `update_attributes_from_transaction_state`) would perform the synchronization prematurely before a transaction is finalized (i.e. comitted or rolled back). As a result, when the actuall rollback happens, the record will incorrectly assumes that its internal states match the transaction state, and neglect to perform the restore. Second, `update_attributes_from_transaction_state` calls `committed!` in some cases. This in turns checks for the `destroyed?` state which also requires synchronization with the transaction stae, which causes an infnite recurrsion. This fix works by deferring the synchronization until the transaction has been finalized (addressing the first point), and also unrolled the `committed!` and `rolledback!` logic in-place (addressing the second point). It should be noted that the primary purpose of the `committed!` and `rolledback!` methods are to trigger the relevant transactional callbacks. Since this code path is only entered when there are no transactional callbacks on the model, this shouldn't be necessary. By unrolling the method calls, the intention here (to restore the states when necessary) becomes more clear.
* | | | Make AR::Base#touch fire the after_commit and after_rollback callbacksHarry Brundage2014-01-161-0/+4
| | | |
* | | | sqlite >= 3.8.0 supports partial indexesCody Cutrer2014-01-141-0/+6
| | | |