aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #15723 from akshay-vishnoi/sql-correctionZachary Scott2014-06-151-2/+2
|\ | | | | [ci skip] Use `an` for SQL
| * [ci skip] Use `an` for SQLAkshay Vishnoi2014-06-141-2/+2
| |
* | Deprecate `serialized_attributes` without replacementSean Griffin2014-06-141-0/+5
|/ | | | | We've stopped using it internally, in favor of polymorphism. So should you!
* Parsing DATABASE_URI, use URI#hostname: it's smarter about IPv6Matthew Draper2014-06-141-0/+7
| | | | Fixes #15705.
* Through associations should set both parent ids on join modelsSean Griffin2014-06-131-0/+5
| | | | | | | | | | | | | member = Member.new(club: Club.new) member.save! Before: member.current_membership.club_id # => nil After: member.current_membership.club_id # => club's id
* Detect in-place changes on mutable AR attributesSean Griffin2014-06-131-0/+6
| | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* Merge pull request #15394 from ↵Yves Senn2014-06-121-0/+7
|\ | | | | | | | | | | | | | | | | morgoth/fix-automatic-maintaining-test-schema-for-sql-format ActiveRecord::Migration.maintain_test_schema! doesn't work with structure.sql Conflicts: activerecord/CHANGELOG.md
| * Fixed automatic maintaining test schema to properly handle sql structure ↵Wojciech Wnętrzak2014-06-121-0/+5
| | | | | | | | | | | | | | | | | | schema format. Additionally: * It changes `purge` task on `sqlite3` adapter to recreate database file, to be consistent with other adapters. * Adds `purge` step when loading from `schema.rb`
* | Pluck should work with columns of the same name from different tablesSean Griffin2014-06-111-0/+7
| | | | | | | | | | | | | | | | The column name given by the adapter doesn't include the table namespace, so going through the hashed version of the result set causes overridden keys. Fixes #15649
* | rm cached attributesSean Griffin2014-06-111-0/+4
| | | | | | | | | | | | | | | | | | | | The original patch that added this concept can be found [here](https://web.archive.org/web/20090601022739/http://dev.rubyonrails.org/ticket/9767). The current default behavior is to cache everything except serialized columns, unless the user specified otherwise. If anyone were to specify otherwise, many types would actually be completely broken. Still, the method is left in place with a deprecation warning in case anyone is actually still calling this method.
* | Remove deprecated method ActiveRecord::Base.quoted_locking_columnAkshay Vishnoi2014-06-101-0/+4
| |
* | ActiveRecord::FinderMethods.find passes proc parameter #15382James Yang2014-06-101-0/+7
| |
* | Timestamp values should be present on callbacksRafael Mendonça França2014-06-091-4/+0
| | | | | | | | | | | | | | This reverts commit dd3ea17191e316aeebddaa7b176f6cfeee7a6365 and add a regression test. Fixes #15418
* | changelog for #15556 and credit @kuldeepaggarwal [Kuldeep Aggarwal]Yves Senn2014-06-071-0/+6
| | | | | | | | | | | | This is a follow up to #15556 @kuldeepaggarwal did submit this patch way back (#13624).
* | credit JoseLuis Torres for #15051. [JoseLuis Torres]Yves Senn2014-06-061-1/+1
| | | | | | | | [ci skip]
* | `ActiveRecord::SchemaMigration` has no primary key.Yves Senn2014-06-061-0/+7
| | | | | | | | | | | | | | | | | | | | Before this patch, using `ActiveRecord::Base.primary_key_prefix_type` with `:table_name_with_underscore` would change the `SchemaMigration` model to have a primary key. This resulted in broken queries for PG because it tried to return the inserted PK (which does not exist). Closes #15051. Closes #15419.
* | `bin/rake db:migrate:status` works with legacy migration numbers.Yves Senn2014-06-061-0/+6
| | | | | | | | | | | | | | The migration numbers were normalized different ways. This left the task output in an inconsistent state. Closes #15538.
* | Merge pull request #14971 from versioncontrol/#14785Yves Senn2014-06-061-0/+9
|\ \ | | | | | | | | | Baseclass becomes! subclass
| * | Fix Baseclass becomes! subclass.Edo Balvers2014-05-131-0/+9
| | |
* | | Merge pull request #15512 from akshay-vishnoi/delete-deprecated-methodYves Senn2014-06-051-0/+5
|\ \ \ | | | | | | | | | | | | Remove deprecated method ActiveRecord::Migrator.proper_table_name
| * | | Remove deprecated method ActiveRecord::Migrator.proper_table_nameAkshay Vishnoi2014-06-051-0/+4
|/ / /
* | | Merge pull request #15482 from laurocaetano/fix-regression-for-eager-loadCarlos Antonio da Silva2014-06-041-0/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fix regression on eager loading association based on SQL query rather than existing column. Conflicts: activerecord/CHANGELOG.md
| * | | Fix regression on eager loading association based on SQL query ratherLauro Caetano2014-06-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | than existing column. Fixes #15480.
* | | | Cleaned up duplicated CHANGELOG entry [ci skip]Godfrey Chan2014-06-031-3/+2
| | | |
* | | | Merge pull request #15438 from sgrif/sg-null-columnRafael Mendonça França2014-06-031-0/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Return a null column when no column exists for an attribute Conflicts: activerecord/CHANGELOG.md
| * | | | Return a null column when no column exists for an attributeSean Griffin2014-06-031-0/+4
| | | | |
* | | | | Merge pull request #15172 from notEthan/active_record_pretty_printRafael Mendonça França2014-06-031-0/+4
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | implement ActiveRecord::Base#pretty_print Conflicts: activerecord/CHANGELOG.md
| * | | | implement ActiveRecord::Base#pretty_print + changelogEthan2014-05-291-0/+4
| | | | |
* | | | | pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-031-5/+2
| |/ / / |/| | |
* | | | pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-031-1/+5
| | | |
* | | | pg, preserve point type when schema dumping.Yves Senn2014-06-031-0/+4
| | | |
* | | | 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