aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | New records should remain new after yaml serializationSean Griffin2014-06-011-0/+4
| |_|/ / |/| | |
* | | | pg, support default values for enum types. Closes #7814.Yves Senn2014-05-301-0/+4
| | | | | | | | | | | | | | | | | | | | This is an intermediate solution. It is related to the refactoring @sgrif is making and will change in the future.
* | | | pg, `default_sequence_name` respects schema. Closes #7516.Yves Senn2014-05-301-0/+4
| | | |
* | | | Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinctYves Senn2014-05-301-0/+5
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed #columns_for_distinct of postgresql adapter Conflicts: activerecord/CHANGELOG.md
| * | | | Fixed `columns_for_distinct` of postgresql adapterNikolay Kondratyev2013-08-151-0/+5
| | | | |
* | | | | pg, `reset_pk_sequence!` respects schemas. Closes #14719.Yves Senn2014-05-301-0/+4
| |/ / / |/| | |
* | | | pg, keep `hstore` and `json` attributes as `Hash` in @attributes.Yves Senn2014-05-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The solution presented in this patch is not efficient. We should replace it in the near future. The following needs to be worked out: * Is `@attributes` storing the Ruby or SQL representation? * `cacheable_column?` is broken but `hstore` and `json` rely on that behavior Refs #15369. /cc @sgrif @rafaelfranca
* | | | Merge pull request #15374 from sgrif/sg-private-propertiesRafael Mendonça França2014-05-271-6/+0
|\ \ \ \ | | | | | | | | | | Remove AR Properties from the public API
| * | | | Remove AR Properties from the public APISean Griffin2014-05-271-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Making this part of the public API was premature, let's make it private again while I continue to work on the surrounding code.
* | | | | Add CHANGELOG entry for #15269 [ci skip]Rafael Mendonça França2014-05-271-0/+4
|/ / / /
* | | | Fix redefine a has_and_belongs_to_many inside inherited classArthur Neves2014-05-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After ad7b5efb55bcc2e0ccd3e7f22a81e984df8676d1, which changed how has_an_belongs_to_many used to work, we start raising an error when redefining the same has_an_belongs_to_many association. This commits fix that regression. [Fixes #14983]
* | | | Typo in AR CHANGELOG [ci skip]Zachary Scott2014-05-261-1/+1
| | | |
* | | | Add a public API to allow users to specify column typesSean Griffin2014-05-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a result of all of the refactoring that's been done, it's now possible for us to define a public API to allow users to specify behavior. This is an initial implementation so that I can work off of it in smaller pieces for additional features/refactorings. The current behavior will continue to stay the same, though I'd like to refactor towards the automatic schema detection being built off of this API, and add the ability to opt out of automatic schema detection. Use cases: - We can deprecate a lot of the edge cases around types, now that there is an alternate path for users who wish to maintain the same behavior. - I intend to refactor serialized columns to be built on top of this API. - Gem and library maintainers are able to interact with `ActiveRecord` at a slightly lower level in a more stable way. - Interesting ability to reverse the work flow of adding to the schema. Model can become the single source of truth for the structure. We can compare that to what the database says the schema is, diff them, and generate a migration.
* | | | Merge pull request #15210 from arthurnn/fix_hbtm_reflectionArthur Neves2014-05-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix habtm reflection Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/reflection_test.rb
* | | | Future port c8ddb61Zachary Scott2014-05-231-9/+10
| | | |
* | | | Fixed serialization for records with an attribute named `format`.Godfrey Chan2014-05-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * * * This bug can be triggered when serializing record R (the instance) of type C (the class), provided that the following conditions are met: 1. The name of one or more columns/attributes on C/R matches an existing private method on C (e.g. those defined by `Kernel`, such as `format`). 2. The attribute methods have not yet been generated on C. In this case, the matching private methods will be called by the serialization code (with no arguments) and their return values will be serialized instead. If the method requires one or more arguments, it will result in an `ArgumentError`. This regression is introduced in d1316bb. * * * Attribute methods (e.g. `#name` and `#format`, assuming the class has columns named `name` and `format` in its database table) are lazily defined. Instead of defining them when a the class is defined (e.g. in the `inherited` hook on `ActiveRecord::Base`), this operation is deferred until they are first accessed. The reason behind this is that is defining those methods requires knowing what columns are defined on the database table, which usually requires a round-trip to the database. Deferring their definition until the last-possible moment helps reducing unnessary work, especially in development mode where classes are redefined and throw away between requests. Typically, when an attribute is first accessed (e.g. `a_book.format`), it will fire the `method_missing` hook on the class, which triggers the definition of the attribute methods. This even works for methods like `format`, because calling a private method with an explicit receiver will also trigger that hook. Unfortunately, `read_attribute_for_serialization` is simply an alias to `send`, which does not respect method visibility. As a result, when serializing a record with those conflicting attributes, the `method_missing` is not fired, and as a result the attribute methods are not defined one would expected. Before d1316bb, this is negated by the fact that calling the `run_callbacks` method will also trigger a call to `respond_to?`, which is another trigger point for the class to define its attribute methods. Therefore, when Active Record tries to run the `after_find` callbacks, it will also define all the attribute methods thus masking the problem. * * * The proper fix for this problem is probably to restrict `read_attribute_for_serialization` to call public methods only (i.e. alias `read_attribute_for_serialization` to `public_send` instead of `send`). This however would be quite risky to change in a patch release and would probably require a full deprecation cycle. Another approach would be to override `read_attribute_for_serialization` inside Active Record to force the definition of attribute methods: def read_attribute_for_serialization(attribute) self.class.define_attribute_methods send(attribute) end Unfortunately, this is quite likely going to cause a performance degradation. This patch therefore restores the behaviour from the 4-0-stable branch by explicitly forcing the class to define its attribute methods in a similar spot (when records are initialized). This should not cause any extra roundtrips to the database because the `@columns` should already be cached on the class. Fixes #15188.
* | | | Merge pull request #14803 from kuldeepaggarwal/null_relation_sum_fixMatthew Draper2014-05-221-0/+5
|\ \ \ \ | | | | | | | | | | | | | | | Fixed a problem where `sum` used with a `group` was not returning a Hash.
| * | | | Fixed a problem where `sum`, `size`, `average`, `minimum` and `maximum` usedKuldeep Aggarwal2014-05-151-0/+5
| | | | | | | | | | | | | | | | | | | | with a grouping was not returning a Hash.
* | | | | Merge pull request #14613 from Sirupsen/fix-serialize-update-columnRafael Mendonça França2014-05-211-0/+5
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix serialized field returning serialized data after update_column Conflicts: activerecord/CHANGELOG.md
| * | | | | Fix serialized field returning serialized data after update_columnSimon Eskildsen2014-04-051-0/+5
| | | | | |
* | | | | | Revert "Merge pull request #14544 from jefflai2/named_scope_sti"Rafael Mendonça França2014-05-211-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9a1abedcdeecd9464668695d4f9c1d55a2fd9332, reversing changes made to c72d6c91a7c0c2dc81cc857a1d6db496e84e0065. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/comment.rb This change break integration with activerecord-deprecated_finders so I'm reverting until we find a way to make it work with this gem.
* | | | | | Fix polymorphic eager load with foreign_key as String.Lauro Caetano2014-05-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The foreign_key could be `String` and just doing `owners_map[owner_key]` could return `nil`. To prevent this bug, we should `to_s` both keys if their types are different. Fixes #14734.
* | | | | | Merge pull request #14544 from jefflai2/named_scope_stiRafael Mendonça França2014-05-201-0/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Issue #13466. Conflicts: activerecord/CHANGELOG.md
| * | | | | | Fixes Issue #13466.Jefferson Lai2014-04-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed the call to a scope block to be evaluated with instance_eval. The result is that ScopeRegistry can use the actual class instead of base_class when caching scopes so queries made by classes with a common ancestor won't leak scopes.
* | | | | | | Merge pull request #14979 from brocktimus/masterRafael Mendonça França2014-05-201-0/+8
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Making belongs_to: touch behaviour be consistent with save updating updated_at
| * | | | | | | Prevented belongs_to: touch propagating up if there are no changes being savedBrock Trappitt2014-05-211-0/+8
| | | | | | | |
* | | | | | | | Revert "Revert "Merge pull request #8313 from ↵Rafael Mendonça França2014-05-201-6/+6
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alan/only_save_changed_has_one_objects"" This reverts commit e94e6c27af495a2460c811bb506459f1428dec6b. Conflicts: activerecord/CHANGELOG.md The original commit was reverted only to be safe since #14407 were reported. We don't have any proof we added a regression with the original commit so reverting it now will give us more problem. Closes #14407
* | | | | | | Fixed the inferred table name for HABTM within a schemaEric Chahin2014-05-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #14824.
* | | | | | | Remove :timestamp column typeSean Griffin2014-05-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* | | | | | | Merge pull request #10798 from ↵Rafael Mendonça França2014-05-191-0/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | jcxplorer/fix-enable_extension-with-table_name_prefix Fix migrations that use enable_extension with table_name_prefix/suffix Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/migration.rb
| * | | | | | | Fix migrations with enable_extensionJoao Carlos2013-05-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using ActiveRecord::Base.table_name_prefix and/or table_name_suffix, extension names got the same treatment as table names when running migrations. This led to migrations that tried to call, for example, enable_extension("prefix_hstore") on the connection.
* | | | | | | | Make `:index` in migrations work with all column typesMarc Schütz2014-05-181-0/+5
| | | | | | | |
* | | | | | | | Merge pull request #14428 from jnormore/reset_counters_aliasRafael Mendonça França2014-05-171-0/+4
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Updates reset_counters to allow counter name in params
| * | | | | | | | Updates reset_counters to allow counter name in paramsJason Normore2014-05-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`. This is to be consistent with the other methods in the module that all accept counter name.
* | | | | | | | | Fix typo in CHANGELOG entry for #15071Leandro Facchinetti2014-05-171-1/+3
|/ / / / / / / /
* | | | | | | | Add CHANGELOG entry for #15071 [ci skip]Rafael Mendonça França2014-05-161-0/+8
| | | | | | | |
* | | | | | | | formatting pass through CHANGELOGS. [ci skip]Yves Senn2014-05-161-5/+5
| | | | | | | |
* | | | | | | | Changed extract_limit in class Column to return correct mysql float and ↵Aaron Nelson2014-05-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | double limits
* | | | | | | | Merge pull request #14871 from kassio/kb-fixes-namespaced-habtmRafael Mendonça França2014-05-141-0/+7
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix how to compute class name on habtm namespaced. Conflicts: activerecord/CHANGELOG.md
| * | | | | | | | Fix how to compute class name on habtm namespaced.Kassio Borges2014-05-131-0/+6
| | |_|_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thank's for @laurocaetano for the help with tests. :smiley: Fixes #14709
* | | | | | | | Merge pull request #15078 from nbudin/fix_merger_filter_binds_comparison_masterRafael Mendonça França2014-05-141-0/+9
|\ \ \ \ \ \ \ \ | |_|_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make filter_binds filter out symbols that are equal to strings Conflicts: activerecord/CHANGELOG.md
| * | | | | | | Make filter_binds filter out symbols that are equal to stringsNat Budin2014-05-141-0/+9
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::Relation::Merger's filter_binds method does not filter out bind variables when one of the attribute nodes has a string name, but the other has a symbol name, even when those names are actually equal. This can result in there being more bind variables than placeholders in the generated SQL. This is particularly an issue for PostgreSQL, where this is treated as an error. This patch changes the filter_binds method to make it convert both attribute names to strings before comparing.
* / / / / / / Fix inheritance of stored_attributes (fixes #14672)Jessica Yao2014-05-141-0/+7
|/ / / / / / | | | | | | | | | | | | | | | | | | [Brad Bennett, Jessica Yao, & Lakshmi Parthasarathy]
* | | | | | pg, `change_column_default` accepts `[]`. Closes #11586.Yves Senn2014-05-121-0/+6
| | | | | |
* | | | | | pg, map `char` and `name` types as string. [dark-panda & Yves Senn]Yves Senn2014-05-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Closes #10802.
* | | | | | pg, fix Infinity and NaN values conversion.Innokenty Mihailov2014-05-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Before this patch `Infinity`, `-Infinity` and `Nan` were read as `0`.
* | | | | | Handle other pk types in PostgreSQL gracefully.Patrick Robertson2014-05-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #10410 it was noted that you can no longer create PK's with the type of bigserial in PostgreSQL in 4.0.0.rc1. This is mostly because the newer adapter is checking for column type with the id column instead of just letting it pass through like it did before. Side effects: You may just create a PK column of a type that you really don't want to be your PK. As far as I can tell this was allowed in 3.2.X and perhaps an exception should be raised if you try and do something extremely dumb.
* | | | | | deprecate, join, preload, eager load of instance dependent associations.Yves Senn2014-05-101-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #15024. These operations happen before instances are created. The current behavior is misleading and can result in broken behavior.
* | | | | | Reverts "Fix bugs with changed attributes tracking when transaction gets ↵Arthur Neves2014-05-091-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rollback" We are reverting these commits, because there are other caveats related to dirty attributes not being restored when a transaction is rollback. For instance, nested transactions cannot proper restore the dirty attributes state after a rollback. At the moment, the dirty attributes are scoped by the transaction. When we call `.save` on a record, the dirty attributes will be reset even if the transaction gets rollback. [related #13166] [related #15018] [related #15016] [closes #15019] This reverts commits * bab48f0a3d53a08bc23ea0887219e8deb963c3d9 * b0fa7cf3ff8432cc2eef3682b34763b7f8c93cc8. * 73fb39b6faa9de593ae75ad4e3b8e065ea0e53af * 37c238927fbed059de3f26a90d8923fb377568a5. * 8d8d4f1560264cd1c74364d67fa0501f6dd2c4fa Revert "Merge pull request #13166 from bogdan/transaction-magic"
* | | | | | Fixed HABTM's CollectionAssociation sizeFred Wu2014-05-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HABTM should fall back to using the normal CollectionAssociation's size calculation if the collection is not cached or loaded. This addresses both #14913 and #14914 for master.