aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #28042 from kamipo/add_changelog_for_27384Rafael França2017-02-211-0/+4
|\ | | | | Add CHANGELOG entry for #27384 and #27762
| * Add CHANGELOG entry for #27384 and #27762Ryuta Kamizono2017-02-171-0/+4
| |
* | Add backticks around method namesJon Moss2017-02-211-1/+1
|/ | | | [ci skip]
* Omit redundant `using: :btree` for schema dumpingRyuta Kamizono2017-02-131-0/+4
|
* Deprecate passing `default` to `index_name_exists?`Ryuta Kamizono2017-02-131-3/+7
|
* Schema dumping support for PostgreSQL oid typeRyuta Kamizono2017-02-121-1/+1
| | | | Closes #27980
* Schema dumping support for PostgreSQL interval typeRyuta Kamizono2017-02-121-0/+4
| | | | Closes #27979
* Deprecate `supports_primary_key?`Ryuta Kamizono2017-02-121-0/+5
| | | | | | | | | | | | `supports_primary_key?` was added to determine if `primary_key` is implemented in the adapter in f060221. But we already use `primary_key` without `supports_primary_key?` (207f266, 5f3cf42) and using `supports_primary_key?` has been removed in #1318. This means that `supports_primary_key?` is no longer used in the internal and Active Record doesn't work without `primary_key` is implemented (all adapters must implement `primary_key`). Closes #27977
* Make `table_name=` reset current statement cachenamusyaka2017-02-121-0/+5
| | | | | | So queries are not run against the previous table name. Closes #27953
* Merge pull request #27945 from betesh/allow-frozen-hashes-to-as_jsonRafael Mendonça França2017-02-081-0/+4
|\ | | | | | | Allow ActiveRecord::Base.as_json to accept a frozen Hash
| * Allow ActiveRecord::Base.as_json to accept a frozen HashIsaac Betesh2017-02-081-0/+4
| |
* | Fix inspection behavior when the :id column is not primary keynamusyaka2017-02-091-0/+4
|/
* Merge pull request #25873 from schuetzm/warn_about_dirty_lockRafael Mendonça França2017-02-071-0/+4
|\ | | | | | | Deprecate locking of dirty records
| * Deprecate locking of dirty recordsMarc Schütz2017-02-071-0/+4
| |
* | Remove deprecated behavior that halts callbacks when the return is falseRafael Mendonça França2017-02-071-0/+4
|/
* Deprecate `ColumnDumper#migration_keys`Ryuta Kamizono2017-02-071-0/+4
| | | | | | `ColumnDumper#migration_keys` was extracted to customize keys for standardized column arguments widths. But the feature was removed in df84e98. The internal method is no longer used for that.
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Fix collection_singular_ids= bugDaniel Colson2017-02-021-0/+6
| | | | | | | | | When the association's primary key is manually set as a symbol and called with an array of strings, CollectionAssociation#ids_writer fails to cast the ids to integers. This is because AssociationReflection#association_primary_key_type and ThroughReflection#association_primary_key_type return the incorrect type, since ModelSchema.type_for_attribute only accepts a string. The result is an ActiveRecord::RecordNotFound error.
* Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+Ryuta Kamizono2017-02-011-0/+19
| | | | | | | | | | | | | | | | | | | MySQL generated columns: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html MariaDB virtual columns: https://mariadb.com/kb/en/mariadb/virtual-computed-columns/ Declare virtual columns with `t.virtual name, type: …, as: "expression"`. Pass `stored: true` to persist the generated value (false by default). Example: create_table :generated_columns do |t| t.string :name t.virtual :upper_name, type: :string, as: "UPPER(name)" t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true t.index :name_length # May be indexed, too! end Closes #22589
* Deprecate `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-201-0/+4
| | | | | | `initialize_internal_metadata_table` These internal initialize methods are no longer used internally.
* Revert "Merge pull request #27718 from kamipo/remove_internal_public_methods"Matthew Draper2017-01-201-5/+0
| | | | | This reverts commit 39c77eb1843f79925c7195e8869afc7cb7323682, reversing changes made to 9f6f51be78f8807e18fc6562c57af2fdbf8ccb56.
* Add CHANGELOG entry for #24743Ryuta Kamizono2017-01-191-2/+6
|
* Remove `initialize_schema_migrations_table` and ↵Ryuta Kamizono2017-01-181-5/+10
| | | | | | | | | | | | `initialize_internal_metadata_table` internal public methods These internal methods accidentally appeared in the doc, and so almost useless. It is enough to create these internal tables directly, and indeed do so in several places. https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/schema.rb#L55 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/railties/databases.rake#L6 https://github.com/rails/rails/blob/v5.0.1/activerecord/lib/active_record/tasks/database_tasks.rb#L230
* Generate migrations at path set by `config.paths["db/migrate"]`Kevin Glowacz2017-01-161-0/+4
|
* Add CHANGELOG entry for #27701Andrew White2017-01-161-0/+4
|
* Add the touch option to ActiveRecord#increment! and decrement!akihiro172017-01-141-0/+4
| | | | | Supports the `touch` option from update_counters. The default behavior is not to update timestamp columns.
* Deprecate reflection class name to accept a classKir Shatrov2017-01-091-0/+5
| | | | | | | | The idea of `class_name` as an option of reflection is that passing a string would allow us to lazy autoload the class. Using `belongs_to :client, class_name: Customer` is eagerloading models more than necessary and creating possible circular dependencies.
* Raise error when has_many through is defined before through associationChris Holmes2017-01-041-0/+6
| | | | | | | https://github.com/rails/rails/issues/26834 This change raises an error if a has_many through association is defined before the through association.
* Merge pull request #26689 from kamipo/deprecate_passing_name_to_indexesRafael Mendonça França2017-01-031-1/+5
|\ | | | | | | Deprecate passing `name` to `indexes` like `tables`
| * Deprecate passing `name` to `indexes` like `tables`Ryuta Kamizono2017-01-041-1/+5
| | | | | | | | | | Passing `name` to `tables` is already deprecated at #21601. Passing `name` to `indexes` is also unused.
* | 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.