aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* `includes` uses SQL parsing when String joins are involved.Yves Senn2014-02-281-0/+7
| | | | | | | | | | | | | | This is a partial revert of 22b3481ba2aa55fad1f9a5db94072312b345fb55. The current implementation of `references_eager_loaded_tables?` needs to know every table involved in the query. With the current API this is not possible without SQL parsing. While a2dab46cae35a06fd5c5500037177492a047c252 deprecated SQL parsing for `includes`. It did not issue deprecation warnings when String joins are involved. This resulted in a breaking change after the deprecated behavior was removed (22b3481ba2aa55fad1f9a5db94072312b345fb55). We will need to rethink the usage of `includes`, `preload` and `eager_load` but for now, this brings back the old *working* behavior.
* Fix a bug affecting validations of enum attributesTheMonster2014-02-271-0/+8
| | | | | | | | | | | | | | This fixes a bug where any enum attribute of a model would be evaluated always as 0 when calling the database on validations. This fix converts the value of the enum attribute to its integer value rather than the string before building the relation as the bug occured when the string finally gets converted to integer using string.to_i which converts it to 0. [Vilius Luneckas, Ahmed AbouElhamayed]
* let `insert_record` actuall save the object.Aaron Patterson2014-02-251-0/+8
| | | | | | | | | | `before_add` callbacks are fired before the record is saved on `has_and_belongs_to_many` assocations *and* on `has_many :through` associations. Before this change, `before_add` callbacks would be fired before the record was saved on `has_and_belongs_to_many` associations, but *not* on `has_many :through` associations. Fixes #14144
* Merge remote-tracking branch ↵Jon Leighton2014-02-251-0/+7
|\ | | | | | | | | | | | | 'chancancode/fix_instance_method_already_implemented' Conflicts: activerecord/CHANGELOG.md
| * Fixed STI classes not defining an attribute method if there is aGodfrey Chan2014-02-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conflicting private method defined on its ancestors. The problem is that `method_defined_within?(name, klass, superklass)` only works correclty when `klass` and `superklass` are both `Class`es. If both `klass` and `superklass` are both `Class`es, they share the same inheritance chain, so if a method is defined on `klass` but not `superklass`, this method must be introduced at some point between `klass` and `superklass`. This does not work when `superklass` is a `Module`. A `Module`'s inheritance chain contains just itself. So if a method is defined on `klass` but not on `superklass`, the method could still be defined somewhere upstream, e.g. in `Object`. This fix works by avoiding calling `method_defined_within?` with a module while still fufilling the requirement (checking that the method is defined withing `superclass` but not is not a generated attribute method). 4d8ee288 is likely an attempted partial fix for this problem. This unrolls that fix and properly check the `superclass` as intended. Fixes #11569.
* | 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
| | | | |