aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | | Merge pull request #35212 from kamipo/sqlite3_foreign_keyRyuta Kamizono2019-02-1112-24/+83
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SQLite3: Implement `add_foreign_key` and `remove_foreign_key`
| * | | | | | | | | Revert "Merge pull request #33563 from lzap/foreign-key-note-doc"Ryuta Kamizono2019-02-111-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 141f50ef9ee6ce26820549e9f5b4629ddee182ce, reversing changes made to 317efa5c3593b70e9cc9a2fcb67488a302b71731. Reason: `add_foreign_key` and `remove_foreign_key` are implemented at #35212. [ci skip]
| * | | | | | | | | SQLite3: Implement `add_foreign_key` and `remove_foreign_key`Ryuta Kamizono2019-02-1111-21/+83
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I implemented Foreign key create in `create_table` for SQLite3 at #24743. This follows #24743 to implement `add_foreign_key` and `remove_foreign_key`. Unfortunately SQLite3 has one limitation that `PRAGMA foreign_key_list(table-name)` doesn't have constraint name. So we couldn't implement find/remove foreign key by name for now. Fixes #35207. Closes #31343.
* | | | | | | | | More exercise table name prefix and suffix testsRyuta Kamizono2019-02-115-33/+97
| | | | | | | | |
* | | | | | | | | Revert "Merge pull request #35211 from y-yagi/fix_broken_association_test" ↵Yuji Yaginuma2019-02-111-16/+0
| |/ / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#35217) This reverts commit 38f9e41f2c4b64377ffb036c53873dbfb51546cf, reversing changes made to 5e493c3b839f10d639f5cce1f1b9ff9292702821. Reason: The ajv@6.9.1 was released that fixes issue.
* | | | | | | | Merge pull request #35211 from y-yagi/fix_broken_association_testYuji Yaginuma2019-02-101-0/+16
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Avoid ajv@6.9.0 for now
| * | | | | | | | Avoid ajv@6.9.0 for nowyuuji.yaginuma2019-02-101-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because ajv@6.9.0 does not work with webpack. Ref: https://github.com/epoberezkin/ajv/issues/941
* | | | | | | | | Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2019-02-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/491045821#L1528-L1531
* | | | | | | | | Merge pull request #35203 from chiastolite/add_column_without_column_namesRyuta Kamizono2019-02-102-0/+12
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | | | | | | | | | | Do not allow to add column without column name
| * | | | | | | | Do not allow to add column without column nameHiroyuki Morita2019-02-102-0/+10
| | | | | | | | |
* | | | | | | | | Merge pull request #35201 from rails/no-leaks2Aaron Patterson2019-02-098-20/+60
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | Fix memory leaks in development
| * | | | | | | | Always call superAaron Patterson2019-02-083-3/+1
| | | | | | | | |
| * | | | | | | | reuse details cache key identity objectAaron Patterson2019-02-081-5/+1
| | | | | | | | |
| * | | | | | | | Teach DetailsKey how to clear the template cacheAaron Patterson2019-02-085-11/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit exposes all system wide view paths so that we can clear their caches.
| * | | | | | | | Split digest cache from details identity cacheAaron Patterson2019-02-084-8/+27
| | |_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit splits the digest cache from the "details identity" cache. Now both caches can be managed independently.
* | | | | | | | Refactor to extract defining column methods as `define_column_methods`Ryuta Kamizono2019-02-093-142/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes to ease to handle all short-hand methods (e.g. validates arguments etc).
* | | | | | | | Fix rubocop violationsyuuji.yaginuma2019-02-092-11/+9
| | | | | | | |
* | | | | | | | Remove redundant returning `object`Ryuta Kamizono2019-02-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `object.transform_values!` returns `object` itself.
* | | | | | | | Use Ruby 2.4+ native transform_values(!)Kasper Timm Hansen2019-02-081-7/+2
| | | | | | | |
* | | | | | | | Delete uneeded blank fileGuillermo Iguaran2019-02-081-0/+0
| | | | | | | |
* | | | | | | | Add 'Hash#deep_transform_values', and 'Hash#deep_transform_values!'Guillermo Iguaran2019-02-085-0/+84
| | | | | | | |
* | | | | | | | Refactor to just use `Association#target=` in `associate_records_to_owner`Ryuta Kamizono2019-02-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Association#target=` invokes `loaded!`, so we no longer need to call the `loaded!` explicitly. Since Preloader is private API, we don't guarantee that it behaves like older version as long as using Preloader directly. But this refactoring fortunately also fix the Preloader compatibility issue #35195. Closes #35195.
* | | | | | | | Merge pull request #34618 from bogdanvlviv/fix-elapsed-time-calculationsKasper Timm Hansen2019-02-084-9/+9
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix elapsed time calculations
| * | | | | | | | Fix elapsed time calculationsbogdanvlviv2019-02-084-9/+9
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've found a few places in Rails code base where I think it makes sense to calculate elapsed time more precisely by using `Concurrent.monotonic_time`: - Fix calculation of elapsed time in `ActiveSupport::Cache::MemoryStore#prune` - Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#wait_poll` - Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::ConnectionPool#attempt_to_checkout_all_existing_connections` - Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::Mysql2Adapter#explain` See https://docs.ruby-lang.org/en/2.5.0/Process.html#method-c-clock_gettime https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way Related to 7c4542146f0dde962205e5a90839349631ae60fb
* | | | | | | | Merge pull request #35193 from kamipo/fix_exists_with_distinct_and_offsetRyuta Kamizono2019-02-082-4/+18
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix `relation.exists?` with giving both `distinct` and `offset`
| * | | | | | | | Fix `relation.exists?` with giving both `distinct` and `offset`Ryuta Kamizono2019-02-082-4/+18
| | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `distinct` affects (reduces) rows of the result, so it is important part when both `distinct` and `offset` are given. Replacing SELECT clause to `1 AS one` and removing `distinct` and `order` is just optimization for the `exists?`, we should not apply the optimization for that case. Fixes #35191.
* | | | | | | | Merge pull request #35178 from bogdan/has-many-sizeRyuta Kamizono2019-02-082-2/+17
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Bugfix has_many association #size when ids reader is cached and assoc…
| * | | | | | | Bugfix has_many association #size when ids reader is cached and association ↵Bogdan Gusiev2019-02-082-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is changed
* | | | | | | | Refactor extracting `current_scope_restoring_block` into the scoping classRyuta Kamizono2019-02-082-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Relation is not best place to do this.
* | | | | | | | Merge pull request #35099 from yahonda/diag35098Ryuta Kamizono2019-02-082-3/+4
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Address test_belongs_to_does_not_use_order_by failure
| * | | | | | | | Address `test_belongs_to_does_not_use_order_by` failure due to checking ↵Yasuo Honda2019-02-082-3/+4
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | order by for metadata queries Also, `test_has_one_does_not_use_order_by` should not check metadata queries. Fixes #35098
* | | | | | | | Merge pull request #35187 from jhawthorn/db-selection-resolver_contextEileen M. Uchitelle2019-02-073-7/+8
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | Finish rename of database_operations to database_resolver_context
| * | | | | | | Update CHANGELOG for database_resolver_contextJohn Hawthorn2019-02-071-2/+2
| | | | | | | |
| * | | | | | | Rename database_operations config to *_contextJohn Hawthorn2019-02-072-5/+6
|/ / / / / / /
* | | | | | | Merge pull request #35182 from jhawthorn/db-selection-refactorEileen M. Uchitelle2019-02-073-19/+19
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Improve naming in DatabaseSelector
| * | | | | | Rename database selector operations to contextJohn Hawthorn2019-02-072-18/+18
| | | | | | |
| * | | | | | Rename resolver ivar to operations in ResolverJohn Hawthorn2019-02-061-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're already in the resolver, we call this class "operations" in the middleware, so we should use the same naming here.
| * | | | | | Rename Session.build to Session.callJohn Hawthorn2019-02-062-2/+2
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is more consistent with Resolver, which has build called. This allows using a Proc instead of a class, which could be nice if you need to vary switching logic based on the request in a more ad-hoc way (ie. check if it is an API request).
* | | | | | Merge pull request #35186 from kamipo/fix_leaking_scope_on_relation_createRyuta Kamizono2019-02-075-6/+45
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix `relation.create` to avoid leaking scope to initialization block and callbacks
| * | | | | | Fix `relation.create` to avoid leaking scope to initialization block and ↵Ryuta Kamizono2019-02-075-6/+45
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | callbacks `relation.create` populates scope attributes to new record by `scoping`, it is necessary to assign the scope attributes to the record and to find STI subclass from the scope attributes. But the effect of `scoping` is class global, it was caused undesired behavior that pollute all class level querying methods in initialization block and callbacks (`after_initialize`, `before_validation`, `before_save`, etc), which are user provided code. To avoid the leaking scope issue, restore the original current scope before initialization block and callbacks are invoked. Fixes #9894. Fixes #17577. Closes #31526.
* | | | | | Refactor around scopingRyuta Kamizono2019-02-075-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use `false` as special value to skip to find inherited scope, we could use `skip_inherited_scope = true`, and move `_scoping` back on Relation.
* | | | | | Merge pull request #35036 from rails/av-base-subclassAaron Patterson2019-02-0619-66/+137
|\ \ \ \ \ \ | | | | | | | | | | | | | | Move compiled ERB to an AV::Base subclass
| * | | | | | Fix deprecation warnings and call superAaron Patterson2019-02-061-2/+2
| | | | | | |
| * | | | | | Fix some typos!Aaron Patterson2019-02-062-1/+5
| | | | | | |
| * | | | | | Add a message to help allocate AV::Base instancesAaron Patterson2019-02-061-1/+5
| | | | | | |
| * | | | | | Deprecate finalizer configuration (it doesn't do anything)Aaron Patterson2019-02-064-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Remove finalizer and configuration" This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
| * | | | | | Rename method so it is more descriptiveAaron Patterson2019-02-061-3/+3
| | | | | | |
| * | | | | | Pull generated methods up in to the anonymous subclassAaron Patterson2019-02-063-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Then we don't need the extra module.
| * | | | | | 🚨 Make the cops happy 🚨Aaron Patterson2019-02-063-3/+3
| | | | | | |
| * | | | | | Remove finalizer and configurationAaron Patterson2019-02-065-50/+0
| | | | | | |