aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Respect custom primary keys for associations in `Relation#where`Sean Griffin2015-02-041-0/+6
| | | | | | | | | | While we query the proper columns, we go through normal handling for converting the value to a primitive which assumes it should use the table's primary key. If the association specifies a different value (and we know that we're working with an association), we should use the custom primary key instead. Fixes #18813.
* Correct errors in counter cache updatingSean Griffin2015-02-031-0/+7
| | | | | | | | | | | The cache name should be converted to a string when given, not compared as a symbol. This edge case is already adequately covered by our tests, but was masked by another issue where we were incorrectly updating the counter cache twice. When paired with a bug where we didn't update the counter cache because we couldn't find a match with the name, this made it look like everything was working fine. Fixes #10865.
* Generate consistent names for foreign keysChris Sinjakli2015-02-031-0/+9
|
* Fix validations on child record when record parent has validate: falseeileencodes2015-02-011-0/+12
| | | | | | | | | | | | | | Fixes #17621. This 5 year old (or older) issue causes validations to fire when a parent record has `validate: false` option and a child record is saved. It's not the responsibility of the model to validate an associated object unless the object was created or modified by the parent. Clean up tests related to validations `assert_nothing_raised` is not benefiting us in these tests Corrected spelling of "respects" It's better to use `assert_not_operator` over `assert !r.valid`
* Merge branch 'master' into mdluo-masterAaron Patterson2015-02-011-0/+5
|\ | | | | | | | | | | | | | | | | | | | | * master: Move required error message and changelog to Active Record Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846 Use Module#include instead of send :include, since now is a public method [ci skip] :scissors: warning from controller renderer test Conflicts: activerecord/CHANGELOG.md
| * Move required error message and changelog to Active RecordCarlos Antonio da Silva2015-02-011-0/+5
| | | | | | | | | | The new association error belongs to Active Record, not Active Model. See #18700 for reference.
* | Merge branch 'master' into pr/18316Mingdong Luo2015-01-311-1/+218
|\| | | | | | | | | Conflicts: activerecord/CHANGELOG.md
| * unify CHANGELOG format. [ci skip]Yves Senn2015-01-311-3/+5
| |
| * Fixed AR::Relation#group method when argument is a SQL reserved keywordBogdan Gusiev2015-01-291-0/+7
| |
| * Added #or to ActiveRecord::RelationMatthew Draper2015-01-281-0/+10
| | | | | | | | | | | | | | Post.where('id = 1').or(Post.where('id = 2')) # => SELECT * FROM posts WHERE (id = 1) OR (id = 2) [Matthew Draper & Gael Muller]
| * Don't redefine autosave association callbacks in nested attrsSean Griffin2015-01-281-0/+7
| | | | | | | | | | | | | | | | These callbacks will already have been defined when the association was built. The check against `reflection.autosave` happens at call time, not at define time, so simply modifying the reflection is sufficient. Fixes #18704
| * Move integer range validation to never raise on assignmentSean Griffin2015-01-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that this was originally added to normalize an error that would have otherwise come from the database (inconsistently), it's more natural for us to raise in `type_cast_for_database`, rather than `type_cast_from_user`. This way, things like numericality validators can handle it instead if the user chooses to do so. It also fixes an issue where assigning an out of range value would make it impossible to assign a new value later. This fixes several vague issues, none of which were ever directly reported, so I have no issue number to give. Places it was mentioned which I can remember: - https://github.com/thoughtbot/shoulda-matchers/blob/9ba21381d7caf045053a81f32df7de2f49687820/lib/shoulda/matchers/active_model/allow_value_matcher.rb#L261-L263 - https://github.com/rails/rails/issues/18653#issuecomment-71197026
| * Errors raised in `type_cast_for_database` no longer raise on assignmentSean Griffin2015-01-231-1/+10
| | | | | | | | Fixes #18580.
| * Don't remove join dependencies in `Relation#exists?`Sean Griffin2015-01-231-0/+6
| | | | | | | | Fixes #18632
| * Don't error when invalid json is assigned to a JSON columnSean Griffin2015-01-211-0/+6
| | | | | | | | | | | | | | Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629.
| * Introduce `ActiveRecord::Base#accessed_fields`Sean Griffin2015-01-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method can be used to see all of the fields on a model which have been read. This can be useful during development mode to quickly find out which fields need to be selected. For performance critical pages, if you are not using all of the fields of a database, an easy performance win is only selecting the fields which you need. By calling this method at the end of a controller action, it's easy to determine which fields need to be selected. While writing this, I also noticed a place for an easy performance win internally which I had been wanting to introduce. You cannot mutate a field which you have not read. Therefore, we can skip the calculation of in place changes if we have never read from the field. This can significantly speed up methods like `#changed?` if any of the fields have an expensive mutable type (like `serialize`) ``` Calculating ------------------------------------- #changed? with serialized column (before) 391.000 i/100ms #changed? with serialized column (after) 1.514k i/100ms ------------------------------------------------- #changed? with serialized column (before) 4.243k (± 3.7%) i/s - 21.505k #changed? with serialized column (after) 16.789k (± 3.2%) i/s - 84.784k ```
| * Merge pull request #18458 from brainopia/fix_after_commit_for_fixturesJeremy Kemper2015-01-201-0/+9
| |\ | | | | | | Support after_commit callbacks in transactional fixtures
| | * after_commit runs after transactions with non-joinable parentsbrainopia2015-01-161-0/+9
| | | | | | | | | | | | | | | | | | after_commit callbacks run after committing a transaction whose parent is not `joinable?`: un-nested transactions, transactions within test cases, and transactions in `console --sandbox`.
| * | Merge pull request #18597 from kamipo/add-if-exists-to-drop-tableYves Senn2015-01-201-0/+15
| |\ \ | | | | | | | | Add an `:if_exists` option to `drop_table`
| | * | Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
| * | | Fix wording in AR CHANGELOG about time columns change [ci skip]Prathamesh Sonpatki2015-01-191-1/+1
| |/ /
| * | Run SQL only if attribute changed for update_attribute methodPrathamesh Sonpatki2015-01-181-0/+4
| | | | | | | | | | | | | | | - This is based on https://github.com/rails/rails/issues/18400 but tackling same issue with update_attribute method instead of update method.
| * | Specify correct version in the changelog [ci skip]Sean Griffin2015-01-161-1/+1
| |/
| * Time columns should support time zone aware attributesSean Griffin2015-01-151-0/+14
| | | | | | | | | | | | The types that are affected by `time_zone_aware_attributes` (which is on by default) have been made configurable, in case this is a breaking change for existing applications.
| * Stop special casing null binary data in loggingSean Griffin2015-01-101-0/+5
| | | | | | | | | | | | There's very little value in logging "<NULL binary data>" instead of just "nil". I'd like to remove the column from the equation entirely, and this case is preventing us from doing so.
| * Don't attempt to save dirty attributes which are not persistableSean Griffin2015-01-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sets a precident for how we handle `attribute` calls, which aren't backed by a database column. We should not take this as a conscious decision on how to handle them, and this can change when we make `attribute` public if we have better ideas in the future. As the composed attributes API gets fleshed out, I expect the `persistable_attributes` method to change to `@attributes.select(&:persistable).keys`, or some more performant variant there-of. This can probably go away completely once we fully move dirty checking into the attribute objects once it gets moved up to Active Model. Fixes #18407
| * formatting pass over CHANGELOGs. [ci skip]Yves Senn2015-01-101-2/+2
| |
| * Remove support for the protected attributes gemCarlos Antonio da Silva2015-01-091-0/+4
| | | | | | | | Related to #10690.
| * Fixed typos and wording in ActiveRecord CHANGELOG [ci skip]Prathamesh Sonpatki2015-01-061-5/+5
| |
| * Merge pull request #18358 from ↵Yves Senn2015-01-061-0/+4
| |\ | | | | | | | | | | | | | | | prathamesh-sonpatki/add-test-for-non-string-labeled-fixtures Fix lookup of fixtures with non-string(like Fixnum) label
| | * Fix lookup of fixtures with non-string labelPrathamesh Sonpatki2015-01-061-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | - Fixtures with non-string labels such as integers should be accessed using integer label as key. For eg. pirates(1) or pirates(42). - But this results in NotFound error because the label is converted into string before looking up into the fixtures hash. - After this commit, the label is converted into string only if its a symbol. - This issue was fount out while adding a test case for https://github.com/rails/rails/commit/7b910917.
| * Fix typo in changelog [ci skip]Carlos Antonio da Silva2015-01-051-1/+1
| |
| * remove deprecated support to preload instance-dependent associaitons.Yves Senn2015-01-051-0/+4
| | | | | | | | Addresses https://github.com/rails/rails/commit/ed56e596a0467390011bc9d56d462539776adac1#commitcomment-9145960
| * remove deprecated support for PG ranges with exclusive lower bounds.Yves Senn2015-01-051-0/+4
| | | | | | | | addresses https://github.com/rails/rails/commit/91949e48cf41af9f3e4ffba3e5eecf9b0a08bfc3#commitcomment-9144563
| * remove deprecation warning when modifying a Relation with cached arel.Yves Senn2015-01-051-0/+5
| | | | | | | | This adresses https://github.com/rails/rails/commit/1b7aa62b184c4410c99208f71b59bbac5c5f03be#commitcomment-9147803
| * add punctuation. [ci skip]Yves Senn2015-01-051-2/+2
| |
| * Add has_secure_token to Active Recordrobertomiranda2015-01-041-0/+5
| | | | | | | | | | | | Update SecureToken Docs Add Changelog entry for has_secure_token [ci skip]
| * Change the behavior of boolean columns to be closer to Ruby's semantics.Rafael Mendonça França2015-01-041-0/+9
| | | | | | | | | | | | | | | | Before this change we had a small set of "truthy", and all others are "falsy". Now, we have a small set of "falsy" values and all others are "truthy" matching Ruby's semantics.
| * Change transaction callbacks to not swallowing errors.Rafael Mendonça França2015-01-041-0/+13
| | | | | | | | | | | | | | | | Before this change any error raised inside a transaction callback are rescued and printed in the logs. Now these errors are not rescue anymore and just bubble up, as the other callbacks.
| * Remove deprecated `sanitize_sql_hash_for_conditions`Rafael Mendonça França2015-01-041-0/+4
| |
| * Remove deprecated `Reflection#source_macro`Rafael Mendonça França2015-01-041-0/+4
| |
| * Remove deprecated `symbolized_base_class` and `symbolized_sti_name`Rafael Mendonça França2015-01-041-0/+4
| |
| * Remove deprecated `ActiveRecord::Base.disable_implicit_join_references=`Rafael Mendonça França2015-01-041-0/+4
| |
| * Remove deprecated access to connection specification using a string acessor.Rafael Mendonça França2015-01-041-0/+6
| | | | | | | | Now all strings will be handled as a URL.
| * Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-041-0/+4
| |
| * Return an array of pools from `connection_pools`Rafael Mendonça França2015-01-041-0/+4
| |
| * Return a null column from `column_for_attribute` when no column exists.Rafael Mendonça França2015-01-041-0/+4
| | | | | | | | | | | | | | | | This reverts commit ae96f229f6501d8635811d6b22d75d43cdb880a4. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods.rb
| * Remove deprecated `serialized_attributes`Rafael Mendonça França2015-01-041-0/+4
| |
| * Remove deprecated automatic counter caches on `has_many :through`Rafael Mendonça França2015-01-041-0/+4
| |
| * Add config to halt callback chain on return falseclaudiob2015-01-021-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This stems from [a comment](rails#17227 (comment)) by @dhh. In summary: * New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning. * Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning. For this purpose, this commit introduces a Rails configuration option: ```ruby config.active_support.halt_callback_chains_on_return_false ``` For new Rails 5.0 apps, this option will be set to `false` by a new initializer `config/initializers/callback_terminator.rb`: ```ruby Rails.application.config.active_support.halt_callback_chains_on_return_false = false ``` For existing apps ported to Rails 5.0, the initializers above will not exist. Even running `rake rails:update` will not create this initializer. Since the default value of `halt_callback_chains_on_return_false` is set to `true`, these apps will still accept `return true` as a way to halt callback chains, displaying a deprecation warning. Developers will be able to switch to the new behavior (and stop the warning) by manually adding the line above to their `config/application.rb`. A gist with the suggested release notes to add to Rails 5.0 after this commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931