aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-0725-27/+0
|
* Merge pull request #26073 from kamipo/revert_passing_splat_binds_for_arel_nodeSean Griffin2016-08-064-13/+11
|\ | | | | Revert passing arel node with splat binds for `where`
| * Revert passing arel node with splat binds for `where`Ryuta Kamizono2016-08-062-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Passing arel node with splat binds for `where` was introduced at #22877 for uniqueness validator supports prepared statement. But I'd not like to introduce the following usage: ```ruby Foo.where(arel, *binds) ``` I'd like to revert this internal usage.
| * Don't passing a nil value to `case_sensitive_comparison`Ryuta Kamizono2016-08-063-13/+9
| | | | | | | | | | A `value` is only used for checking `value.nil?`. It is unnecessary if immediately return when `value.nil?`.
* | applies remaining conventions across the projectXavier Noria2016-08-0678-207/+143
| |
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-06183-6777/+6774
| |
* | remove redundant curlies from hash argumentsXavier Noria2016-08-0623-99/+89
| |
* | modernizes hash syntax in activerecordXavier Noria2016-08-06202-2408/+2404
| |
* | applies new string literal convention to the rest of the projectXavier Noria2016-08-064-66/+66
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | applies new string literal convention in the gemspecsXavier Noria2016-08-061-15/+15
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | applies new string literal convention in activerecord/testXavier Noria2016-08-06280-5678/+5678
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | applies new string literal convention in activerecord/libXavier Noria2016-08-06118-840/+840
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | Merge pull request #25998 from kamipo/enum_with_alias_attributeEileen M. Uchitelle2016-08-062-5/+22
|\ \ | |/ |/| Fix `enum` with `alias_attribute`
| * Fix `enum` with `alias_attribute`Ryuta Kamizono2016-07-312-5/+22
| | | | | | | | Fixes #25892.
* | Merge pull request #25665 from kamipo/remove_unused_table_argEileen M. Uchitelle2016-08-051-5/+5
|\ \ | | | | | | Remove unused `table` arg for `UniquenessValidator#scope_relation`
| * | Remove unused `table` arg for `UniquenessValidator#scope_relation`Ryuta Kamizono2016-07-181-5/+5
| | |
* | | Merge pull request #26051 from kamipo/make_name_and_binds_to_optional_argsEileen M. Uchitelle2016-08-053-6/+6
|\ \ \ | | | | | | | | Make `name` and `binds` to optional args for `exec_{insert,update,delete}`
| * | | Make `name` and `binds` to optional args for `exec_{insert,update,delete}`Ryuta Kamizono2016-08-043-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | `insert`, `update`, `delete`, and `exec_query` have a default value against `name` and `binds`. But `exec_insert`, `exec_update`, and `exec_delete` not have. It is an inconvenience and inconsistent.
* | | | Don't assume all hashes are from multiparameter assignment in `composed_of`Sean Griffin2016-08-054-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So this bug is kinda funky. The code path is basically "if we weren't passed an instance of the class we compose to, and we have a converter, call that". Ignoring the hash case for a moment, everything after that was roughly intended to be the "else" clause, meaning that we are expected to have an instance of the class we compose to. Really, we should be blowing up in that case, as we can give a much better error message than what they user will likely get (e.g. `NameError: No method first for String` or something). Still, Ruby is duck typed, so if the object you're assigning responds to the same methods as the type you compose to, knock yourself out. The hash case was added in 36e9be8 to remove a bunch of special cased code from multiparameter assignment. I wrongly assumed that the only time we'd get a hash there is in that case. Multiparameter assignment will construct a very specific hash though, where the keys are integers, and we will have a set of keys covering `1..part.size` exactly. I'm pretty sure this could actually be passed around as an array, but that's a different story. Really I should convert this to something like `class MultiParameterAssignment < Hash; end`, which I might do soon. However for a change that I'm willing to backport to 4-2-stable, this is what I want to go with for the time being. Fixes #25978
* | | | Leave internal pgsql name intact as const referenceDavid Heinemeier Hansson2016-08-041-2/+2
| | | |
* | | | The problem isn't the detection but the deadlock itselfDavid Heinemeier Hansson2016-08-045-10/+10
|/ / /
* | | Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classesRafael Mendonça França2016-08-035-26/+57
|\ \ \ | | | | | | | | | | | | | | | | | | | | Introduce new ActiveRecord transaction error classes Closes #26018
| * | | Introduce new ActiveRecord transaction error classesErol Fornoles2016-05-245-26/+57
| | | |
* | | | Merge pull request #26026 from ↵Rafael França2016-08-031-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | kamipo/tx_serialization_error_should_inherit_statement_invalid `TransactionSerializationError` should inherit `StatementInvalid` for backward compatibility
| * | | | `TransactionSerializationError` should inherit `StatementInvalid` for ↵Ryuta Kamizono2016-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | backward compatibility Originally `TransactionSerializationError` was `StatementInvalid` in Rails 5.0. It should keep backward compatibility.
* | | | | Avoid duplicated `set_inverse_instance` for target scopeRyuta Kamizono2016-08-033-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because `scope` (`target_scope`) is a `AssociationRelation`. `AssociationRelation` handles `set_inverse_instance`. https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/association_relation.rb#L31-L33 See also #26022.
* | | | | Merge pull request #26022 from kamipo/remove_unnecessary_set_inverse_instanceKasper Timm Hansen2016-08-021-6/+2
|\ \ \ \ \ | | | | | | | | | | | | Remove unnecessary `set_inverse_instance` in finder methods
| * | | | | Remove unnecessary `set_inverse_instance` in finder methodsRyuta Kamizono2016-08-021-6/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because `scope` (`target_scope`) is a `AssociationRelation`. `AssociationRelation` handles `set_inverse_instance`. https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/association_relation.rb#L31-L33
* | | | | Remove extra connection pool creationArthur Neves2016-08-021-1/+0
| | | | |
* | | | | Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-08-021-1/+1
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Fix documentation of `index` option for the `add_reference` method [ci skip]Prathamesh Sonpatki2016-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | - Followup of https://github.com/rails/rails/pull/23179.
* | | | | Remove unnecessary methods for `NullRelation`Ryuta Kamizono2016-07-291-29/+7
| |_|_|/ |/| | |
* | | | Merge pull request #25941 from kamipo/finder_methods_uses_load_targetRafael França2016-07-283-5/+7
|\ \ \ \ | | | | | | | | | | `FinderMethods` uses `records` (`load_target`) when `loaded?` is true
| * | | | `FinderMethods` uses `records` (`load_target`) when `loaded?` is trueRyuta Kamizono2016-07-283-5/+7
| | | | |
* | | | | Merge pull request #25940 from kamipo/fix_collection_proxy_loadRafael França2016-07-282-0/+14
|\ \ \ \ \ | | | | | | | | | | | | Fix to `CollectionProxy#load` does `load_target`
| * | | | | Fix to `CollectionProxy#load` does `load_target`Ryuta Kamizono2016-07-252-0/+14
| |/ / / /
* | | | | Merge pull request #25937 from kamipo/remove_prepare_binds_for_databaseRafael França2016-07-284-8/+4
|\ \ \ \ \ | | | | | | | | | | | | Remove `prepare_binds_for_database` internal method
| * | | | | Remove `prepare_binds_for_database` internal methodRyuta Kamizono2016-07-284-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | To avoid relying on the connection adapter for type casting binds.
* | | | | | Merge pull request #25340 from kamipo/prevent_table_comment_queryRafael França2016-07-283-7/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | Prevent `table_comment` query if a table doesn't have a comment
| * | | | | | Prevent `table_comment` query if a table doesn't have a commentRyuta Kamizono2016-06-103-7/+17
| | | | | | |
* | | | | | | Merge pull request #25974 from ↵Rafael França2016-07-281-2/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/avoid_calling_current_database_in_table_comment Avoid calling `current_database` in `table_comment`
| * | | | | | | Avoid calling `current_database` in `table_comment`Ryuta Kamizono2016-07-281-2/+4
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `current_database` executes a query and `table_comment` is called to all tables even if a table does not have a comment. Using `current_database` increases extra queries.
* / | | | | | `@quoted_{column,table}_names` should cache a frozen stringRyuta Kamizono2016-07-283-5/+5
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Caching a mutable string causes the following issue. ``` Loading development environment (Rails 5.1.0.alpha) irb(main):001:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!" irb(main):002:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!" irb(main):003:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!!!" ```
* | | | | | Merge pull request #25767 from ↵Rafael França2016-07-274-3/+20
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/association_name_is_the_same_as_join_table_name Correctly return `associated_table` when `associated_with?` is true
| * | | | | | Correctly return `associated_table` when `associated_with?` is trueRyuta Kamizono2016-07-104-3/+20
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `AssociationQueryHandler` requires `association` initialized `TableMetadata` even if `table_name == arel_table.name`. Fixes #25689.
* | | | | | Add the TABLE_SCHEMA condition to the SELECT statement in table_comment (#25945)Takeshi AKIMA2016-07-272-1/+6
| | | | | | | | | | | | | | | | | | [Rafael Mendonça França + Takeshi AKIMA]
* | | | | | Merge pull request #25702 from k0kubun/joins-circular-referenceSean Griffin2016-07-272-1/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove circular join references in join_dependency
| * | | | | | Remove circular join references in join_dependencyTakashi Kokubun2016-07-282-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #25653.
* | | | | | | Merge pull request #25938 from ↵Rafael França2016-07-272-10/+10
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | kamipo/decouple_statement_cache_from_connection_adapter Decouple statement cache from connection adapter
| * | | | | | Decouple statement cache from connection adapterRyuta Kamizono2016-07-242-10/+10
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | `StatementCache` is hard-coded in `cacheable_query` and be passed `visitor` and `collector` from connection adapter. Simply it is enough to pass a collected value.