aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* | Remove deprecation of using ActiveRecord::Base instance in .updateRafael Mendonça França2017-01-031-2/+2
| |
* | Remove deprecated db:test:clone* tasksRafael Mendonça França2017-01-031-0/+4
| |
* | Rephrase CHANGELOG.md entryJon Moss2017-01-031-1/+1
|/ | | | | | Rephrase entry with better sounding English. [ci skip]
* Compare deserialized values for `PostgreSQL::OID::Hstore` typesJon Moss2017-01-031-0/+7
| | | | | | | | | | | | | Per the regression commit below, the commit changes the behavior of `#changed?`to consult the `#changed_in_place?` method on `Type::Value` classes. Per this change, `PostgreSQL::OID::Hstore` needs to override this method in order to compare the deserialized forms of the two arguments. In Ruby, two hashes are considered equal even if their key order is different. This commit helps to bring that behavior to `Hstore` values. Fixes regression introduced by 8e633e505880755e7e366ccec2210bbe2b5436e7 Fixes #27502
* Raise ArgumentError when a instance of ActiveRecord::Base is passed toRafael Mendonça França2017-01-031-0/+5
| | | | find and exists?
* Consistently apply adapter behavior when serializing arraysSean Griffin2017-01-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | In f1a0fa9 we moved backend specific timestamp behavior out of the type and into the adapter. This was in line with our general attempt to reduce the number of adapter specific type subclasses. However, on PG, the array type performs all serialization, including database encoding in its serialize method. This means that we have converted the value into a string before reaching the database, so no adapter specific logic can be applied (and this also means that timestamp arrays were using the default `.to_s` method on the given object, which likely meant timestamps were being ignored in certain cases as well) Ultimately I want to do a more in depth refactoring which separates database serializer objects from the active model type objects, to give us a less awkward API for introducing the attributes API onto Active Model. However, in the short term, we follow the solution we've applied elsewhere for this. Move behavior off of the type and into the adapter, and use a data object to allow the type to communicate information up the stack. Fixes #27514.
* Cache results of computing model typeKonstantin Lazarev2017-01-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We faced a significant performance decrease when we started using STI without storing full namespaced class name in type column (because of PostgreSQL length limit for ENUM types). We realized that the cause of it is the slow STI model instantiation. Problematic method appears to be `ActiveRecord::Base.compute_type`, which is used to find the right class for STI model on every instantiation. It builds an array of candidate types and then iterates through it calling `safe_constantize` on every type until it finds appropriate constant. So if desired type isn't the first element in this array there will be at least one unsuccessful call to `safe_constantize`, which is very expensive, since it's defined in terms of `begin; rescue; end`. This commit is an attempt to speed up `compute_type` method simply by caching results of previous calls. ```ruby class MyCompany::MyApp::Business::Accounts::Base < ApplicationRecord self.table_name = 'accounts' self.store_full_sti_class = false end class MyCompany::MyApp::Business::Accounts::Free < Base end class MyCompany::MyApp::Business::Accounts::Standard < Base # patch .compute_type there end puts '======================= .compute_type =======================' Benchmark.ips do |x| x.report("original method") do MyCompany::MyApp::Business::Accounts::Free.send :compute_type, 'Free' end x.report("with types cached") do MyCompany::MyApp::Business::Accounts::Standard.send :compute_type, 'Standard' end x.compare! end ``` ``` ======================= .compute_type ======================= with types cached: 1529019.4 i/s original method: 2850.2 i/s - 536.46x slower ``` ```ruby 5_000.times do |i| MyCompany::MyApp::Business::Accounts::Standard.create!(name: "standard_#{i}") end 5_000.times do |i| MyCompany::MyApp::Business::Accounts::Free.create!(name: "free_#{i}") end puts '====================== .limit(100).to_a =======================' Benchmark.ips do |x| x.report("without .compute_type patch") do MyCompany::MyApp::Business::Accounts::Free.limit(100).to_a end x.report("with .compute_type patch") do MyCompany::MyApp::Business::Accounts::Standard.limit(100).to_a end x.compare! end ``` ``` ====================== .limit(100).to_a ======================= with .compute_type patch: 360.5 i/s without .compute_type patch: 24.7 i/s - 14.59x slower ```
* Fix tests with counter cache touching and more.Kasper Timm Hansen2017-01-011-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor to use `touch_updates` Ensures we only call `current_time_from_proper_timezone` from one place. * Clarify touch default in tests. Not interested in what happens when passed false but that nothing passed means no touching. * Backdate touched columns in tests. We can't be sure a test progresses through time, so our touching code may be working correctly but the test itself is brittle. Fix by backdating that's further in the past akin to what the timestamps tests do: https://github.com/rails/rails/blob/d753645d40e925973724e4c3a8617b654da90e41/activerecord/test/cases/timestamp_test.rb#L17 * Expand changelog entry. Elaborate and show examples. Closes #26995. [ Jarred Trost & Kasper Timm Hansen ]
* Added option to ActiveRecord::CounterCache methods.Jarred Trost2017-01-011-0/+7
|
* Add missing word in activerecord/CHANGELOG.mdJon Moss2016-12-301-1/+1
| | | | [ci skip]
* Remove deprecated `#uniq`, `#uniq!`, and `#uniq_value`Ryuta Kamizono2016-12-301-0/+4
|
* Remove deprecated `#insert_sql`, `#update_sql`, and `#delete_sql`Ryuta Kamizono2016-12-301-0/+4
|
* Grammar linting in activerecord/CHANGELOG.mdJon Moss2016-12-291-5/+5
| | | | [ci skip]
* Fix grammar in AR CHANGELOG.md [ci skip]kenta-s2016-12-301-1/+1
|
* Remove deprecated #use_transactional_fixtures configurationRafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated `#raise_in_transactional_callbacks` configurationRafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated #load_schema_forRafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated conditions parameter from #delete_allRafael Mendonça França2016-12-291-1/+1
|
* Remove deprecated conditions parameter from `#destroy_all`Rafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated support to passing arguments to `#select` when a block is ↵Rafael Mendonça França2016-12-291-0/+4
| | | | provided.
* Remove deprecated support to query using commas on LIMITRafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated support to passing a class as a value in a queryRafael Mendonça França2016-12-291-0/+4
|
* Raises IrreversibleOrderError when using last with an irreversible orderRafael Mendonça França2016-12-291-0/+5
|
* Raise when a through association has an ambiguous reflection nameRafael Mendonça França2016-12-291-0/+4
|
* Raises when `ActiveRecord::Migration` is inherited directly.Rafael Mendonça França2016-12-291-0/+4
|
* Remove original_exception from ActiveRecord::StatementInvalidRafael Mendonça França2016-12-291-0/+5
|
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-0/+6
|
* Remove deprecated `name` argument from `#tables`Rafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated support to passing a column to #quoteRafael Mendonça França2016-12-291-0/+4
|
* Set time as a timezone aware type and remove related deprecationRafael Mendonça França2016-12-291-0/+5
|
* Remove deprecated force reload argument in association readersRafael Mendonça França2016-12-291-0/+4
|
* Remove deprecated i18n scopes in Active RecordRafael Mendonça França2016-12-291-0/+5
|
* [ci skip] Add changelog for 261e94b.Kasper Timm Hansen2016-12-291-0/+7
| | | | [ *Kasper Timm Hansen* & *Kir Shatrov* ]
* Small edits to activerecord/CHANGELOG.mdJon Moss2016-12-271-2/+2
| | | | | | | [ci skip] - add period where necessary - add backticks where necessary
* fix QueryCache nil dupRichard Monette2016-12-151-0/+10
| | | | | | | | | | | | | | make sql statements frozen dup if arel is not our string expect runtime error dont wrap runtime error in invalid log errors will now be treated as runtime errors update changelog
* Add CHANGELOG entry to #27042Rafael Mendonça França2016-12-131-0/+4
| | | | [ci skip]
* Add a changelog entry for #26687 [ci skip]Ryuta Kamizono2016-12-121-0/+7
|
* Add a changelog entry for #25227 [ci skip]Ryuta Kamizono2016-12-101-0/+4
|
* Add a changelog entry for #25451 [ci skip]Ryuta Kamizono2016-12-101-8/+13
|
* Emulate db trigger behaviour for after_commit :destroy, :updateStefan Budeanu2016-12-091-0/+8
| | | | | | Race conditions can occur when an ActiveRecord is destroyed twice or destroyed and updated. The callbacks should only be triggered once, similar to a SQL database trigger.
* Merge pull request #26696 from iainbeeston/only-ruby-types-in-activemodelSean Griffin2016-12-081-0/+4
|\ | | | | | | Moved database-specific ActiveModel types into ActiveRecord
| * Moved database-specific ActiveModel types into ActiveRecordIain Beeston2016-10-141-0/+4
| | | | | | | | ie. DecimalWithoutScale, Text and UnsignedInteger
* | Check whether the current attribute being write is aliased or not before writingPrathamesh Sonpatki2016-12-091-1/+6
| | | | | | | | - If aliased, then use the aliased attribute name.
* | Check whether the current attribute being read is aliased or not before readingPrathamesh Sonpatki2016-12-081-1/+8
| | | | | | | | | | - If aliased, then use the aliased attribute name. - Fixes #26417.
* | Make pg adapter use bigserial for pk by defaultPavel Pravosud2016-12-051-0/+4
| |
* | Fix issue number from becoming markdown headernanaya2016-12-011-2/+2
| | | | | | | | The alternative is escaping it but moving around the text seems a bit simpler.
* | Make the second argument to `attribute` optionalSean Griffin2016-11-301-0/+6
| | | | | | | | | | | | | | | | While working on updating Paper Trail for 5.1 compatibility, I noticed that I was required to pass a second argument to `attribute`. I didn't intend for this to be the case, as `attribute :foo` is totally reasonable shorthand for "I want `attr_accessor :foo`, but also have it work with things like `.attributes` and `ActiveRecord::Dirty`"
* | Fix that unsigned with zerofill is treated as signedRyuta Kamizono2016-11-271-0/+6
| | | | | | | | Fixes #27125.
* | fix the uniqueness validation scope with a polymorphic associationSergey Alekseev2016-11-261-0/+4
| | | | | | | | https://gist.github.com/sergey-alekseev/946657ebdb5e58d1bee115714056ec96
* | Add test for collection *_ids= setter when association primary key setDominic Cleal2016-11-241-0/+4
| | | | | | | | | | | | | | | | Fixes casting of IDs to the data type of the association primary key, rather than then the data type of the model's primary key. (Tests use a string primary key on the association, rather than an int.) Tests issue #20995