aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #30126 from ↵Rafael França2017-08-113-12/+12
|\ \ \ | | | | | | | | | | | | | | | | chopraanmol1/support_for_has_many_and_has_one_for_where_relation Fixed query building when relation is passed for has one or has many association in where
| * | | Changed join_fk private method to join_foreign_key public methodchopraanmol12017-08-093-15/+11
| | | |
| * | | Currently if relation object are passed to where condition for has one or ↵chopraanmol12017-08-082-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | has many association wrong set of primary key and foreign key are selected. Changed code to use 'join' primary key and foreign key over 'association' primary key and foreign key.
* | | | Merge pull request #30159 from allcentury/dump-temp-file-permissionsRafael França2017-08-111-1/+1
|\ \ \ \ | | | | | | | | | | Use copy to preserve file permissions
| * | | | Use copy to preserve file permissionsAnthony Ross2017-08-091-1/+1
| | | | |
* | | | | Merge pull request #29720 from gaurish/ar_find_error_message_improvementRafael França2017-08-112-4/+6
|\ \ \ \ \ | | | | | | | | | | | | Return Not found Ids in ActiveRecord::NotFound
| * | | | | Return Not found Ids in ActiveRecord::NotFoundGaurish Sharma2017-07-292-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This builds on top of 15e2da656f41af0124f7577858536f3b65462ad5. now it also returns exact Ids which were not found which will be debugging simple.
* | | | | | Merge pull request #30193 from zverok/robust-postgres-duplicate-dbRafael França2017-08-111-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | More robust PostgreSQL database duplication check
| * | | | | | Update database duplication checkzverok2017-08-111-1/+1
| | | | | | |
* | | | | | | Specify `table.name` only when `scope.table` and `table` are different (#29058)Ryuta Kamizono2017-08-111-4/+12
| | | | | | | | | | | | | | | | | | | | | Fixes #29045.
* | | | | | | Fix RDoc formatting: `+` doesn't work with `@`ohbarye2017-08-112-6/+6
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refs: https://github.com/rails/rails/pull/30161 ``` $ echo "+@size+" | rdoc --pipe <p>+@size+</p> $ echo "<tt>@size</tt>" | rdoc --pipe <p><code>@size</code></p> ``` [ci skip]
* | | | | | Start `@reaper.run` after connection pool initializedRyuta Kamizono2017-08-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise `ConnectionPool#reap` may run before `@connections` has initialized. https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
* | | | | | Merge pull request #30108 from yui-knk/require_concurrent_mapRafael França2017-08-081-0/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add missed `require`
| * | | | | | Add missed `require`yui-knk2017-08-071-0/+2
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | `ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration` depends on `Concurrent::Map`.
* | | | | | Merge pull request #30142 from ↵Sean Griffin2017-08-081-4/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | yukideluxe/add-missing-bit-reload-associations-docs add missing collection.reload documentation [ci skip]
| * | | | | | add missing collection.reload documentation [ci skip]Julia López2017-08-081-4/+12
| | | | | | |
* | | | | | | Document `ActiveRecord::AttributeMethods::Dirty`Sean Griffin2017-08-081-9/+9
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | This module has behavior that is not present in `ActiveModel::Dirty`, which is intended to be public API.
* | | | | | Merge pull request #30125 from yukideluxe/add-reload-to-associations-docsRafael França2017-08-081-0/+8
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | add reload_association to documentation
| * | | | | add reload_association to documentation [ci skip]Julia López2017-08-071-0/+8
| |/ / / /
* / / / / [ci skip] Postgres --> PostgreSQLRyuta Kamizono2017-08-083-3/+3
|/ / / /
* | | | Merge pull request #29520 from kirs/serialize-vs-postgres-native-columnSean Griffin2017-08-041-0/+24
|\ \ \ \ | |_|_|/ |/| | | Do not let use `serialize` on native JSON/array column
| * | | Do not let use `serialize` on native JSON/array columnKir Shatrov2017-08-041-0/+24
| |/ /
* | / Use `Concurrent::Map` than `Mutex` and `Mutex_m` for statement cachesRyuta Kamizono2017-08-042-10/+6
| |/ |/| | | | | | | Statement caches are used as a concurrent map. It will more clarify to using `Concurrent::Map`.
* | Fix all rubocop violationsRafael Mendonça França2017-08-031-2/+2
| |
* | Passing `klass` to `StatementCache.new`Ryuta Kamizono2017-08-045-24/+23
| | | | | | | | | | | | Actually `StatementCache#execute` is always passed the same klass that the owner klass of the connection when the statement cache is created. So passing `klass` to `StatementCache.new` will make more DRY.
* | Merge pull request #30011 from guilherme/fix-migration-generator-special-casesSean Griffin2017-08-031-1/+1
|\ \ | | | | | | Handling add/remove to/from migration edge cases
| * | Handling add/remove to/from migration edge casesGuilherme Reis Campos2017-08-031-1/+1
| | | | | | | | | | | | Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
* | | Merge pull request #29914 from ↵Matthew Draper2017-08-022-19/+22
|\ \ \ | | | | | | | | | | | | | | | | kamipo/relation_merger_should_not_fill_empty_values `Relation::Merger` should not fill `values` with empty values
| * | | `get_value` and `set_value` in `Relation` are no longer used externallyRyuta Kamizono2017-07-251-9/+10
| | | |
| * | | `Relation::Merger` should not fill `values` with empty valuesRyuta Kamizono2017-07-251-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `Relation#merge` will almost fill `values` with empty values (e.g. `other.order_values` is always true, it should be `other.order_values.any?`). This means that `Relation#merge` always changes `values` even if actually `values` is nothing changed. This behavior will makes `Relation#empty_scope?` fragile. So `Relation#merge` should avoid unnecessary changes.
* | | | Merge pull request #29842 from kamipo/fix_find_by_with_rangeMatthew Draper2017-08-022-4/+8
|\ \ \ \ | | | | | | | | | | Fix `find_by` with range conditions
| * | | | Fix `find_by` with range conditionsRyuta Kamizono2017-07-202-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | `StatementCache` doesn't support range conditions. So we need to through the args to `FinderMethods#find_by` if range value is passed.
* | | | | Merge pull request #29724 from eugeneius/sync_primary_keyMatthew Draper2017-08-023-2/+8
|\ \ \ \ \ | | | | | | | | | | | | Sync transaction state when accessing primary key
| * | | | | Sync transaction state when accessing primary keyEugene Kenny2017-07-093-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a record is modified inside a transaction, it must check the outcome of that transaction before accessing any state which would no longer be valid if it was rolled back. For example, consider a new record that was saved inside a transaction which was later rolled back: it should be restored to its previous state so that saving it again inserts a new row into the database instead of trying to update a row that no longer exists. The `id` and `id=` methods defined on the PrimaryKey module implement this correctly, but when a model uses a custom primary key, the reader and writer methods for that attribute must check the transaction state too. The `read_attribute` and `write_attribute` methods also need to check the transaction state when accessing the primary key.
* | | | | | Merge pull request #29950 from MaxLap/avoid_or_clause_duplicatesSean Griffin2017-07-311-6/+15
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Avoid duplicate clauses when using #or
| * | | | | Edits following the reviewsMaxime Lapointe2017-07-281-6/+8
| | | | | |
| * | | | | Avoid duplicate clauses when using #orMaxime Lapointe2017-07-251-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Condenses the clauses that are common to both sides of the OR and put them outside, before the OR This fix the current behavior where the number of conditions is exponential based on the number of times #or is used.
* | | | | | Change http postgresql.org links to https [ci skip]yuuji.yaginuma2017-07-305-8/+8
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | It seems that it accepts only HTTPS connections. Ref: https://github.com/postgres/postgres/commit/7f77cbd996855a06fb742ea11adbe55c42b48fe2
* | | | | Merge pull request #29946 from kamipo/passing_arel_to_where_is_boundableSean Griffin2017-07-281-4/+1
|\ \ \ \ \ | | | | | | | | | | | | Building `where_clause` in `UniquenessValidator` is no longer needed
| * | | | | Building `where_clause` in `UniquenessValidator` is no longer neededRyuta Kamizono2017-07-261-4/+1
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Building `where_clause` manually was introduced at #26073 to include both `comparison` and `binds` in `where_clause`. Since 213796f, `comparison` includes `binds`, so it is enough to use `where` simply.
* | | | | Use `predicate_builder.build_bind_attribute` wherever possibleRyuta Kamizono2017-07-284-8/+7
| | | | | | | | | | | | | | | | | | | | For less duplicated code.
* | | | | Eager load the association classes on bootRafael Mendonça França2017-07-271-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were expecting those classes to be loaded when an association is defined but they are not. If you add a debugger on the first line of any of those classes and try to define the corresponding association you will see that the classes are not loaded. Fixes #26273
* | | | | Use `_relation_for_itself` wherever possibleSean Griffin2017-07-261-3/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | Anywhere that we're doing `self.class.unscoped.where(primary_key => id)` is somewhere that someone may want to extend. Even if this method isn't public API yet, this will make it easier for us to eventually expose an API around this. Plus, duplicated code makes me sad.
* | | | Merge pull request #29941 from kamipo/remove_single_element_array_preprocessSean Griffin2017-07-252-2/+2
|\ \ \ \ | | | | | | | | | | Remove single element array preprocess
| * | | | Remove single element array preprocessRyuta Kamizono2017-07-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Since 213796f, array predicate handler supports making binds, so the preprocess is no longer needed.
* | | | | Clarify add_column limit documentationLisa Ugray2017-07-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The limit option is ignored by PostgreSQL and may be ignored by 3rd party backends. Make this clear in the docs. Fixes #29922.
* | | | | Allow `Relation#or` to accept a relation with different `references`Sean Griffin2017-07-251-1/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that the two relations must still have the same `includes` values (which is the only time `references` actually does anything). It makes sense for us to allow this, as `references` is called implicitly when passing a hash to `where`. Fixes #29411
* | | | Merge pull request #29934 from kamipo/remove_join_informationSean Griffin2017-07-253-10/+5
|\ \ \ \ | | | | | | | | | | Remove useless `JoinInformation`
| * | | | Remove useless `JoinInformation`Ryuta Kamizono2017-07-253-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Since 213796f removed `binds`, `JoinInformation` only contain `joins`. So it is enough to return `joins` simply.
* | | | | Merge pull request #29935 from kamipo/remove_unused_queries_predicatesSean Griffin2017-07-251-12/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove unused `queries_predicates`