aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation/merging_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove Relation#bind_paramsSean Griffin2015-01-271-2/+2
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Use an `Attribute` object to represent a bind valueSean Griffin2015-01-271-11/+0
| | | | | | | | | | | The column is primarily used for type casting, which we're trying to separate from the idea of a column. Since what we really need is the combination of a name, type, and value, let's use the object that we already have to represent that concept, rather than this tuple. No consumers of the bind values have been changed, only the producers (outside of tests which care too much about internals). This is *finally* possible since the bind values are now produced from a reasonable number of lcoations.
* Remove all cases of manuallly wrapping `Arel::Nodes::Quoted`Sean Griffin2014-12-291-2/+2
| | | | | | | | | | This is no longer required now that we are injecting a type caster object into the Arel table, with the exception of uniqueness validations. Since it calls `ConnectionAdapter#type_cast`, the value has already been cast for the database. We don't want Arel to attempt to cast it further, so we need to continue wrapping it in a quoted node. This can potentially go away when this validator is refactored to make better use of `where` or the predicate builder.
* Inform Arel we don't need additional type casting in testsSean Griffin2014-12-261-2/+2
| | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* Build fix when running in isolationArun Agrawal2014-11-141-0/+1
| | | | | `Computer` class needs to be require See #17217 for more details
* Load :developers fixtures where expecting a Developer to be thereAkira Matsuda2014-09-051-1/+1
|
* "warning: assigned but unused variable"Akira Matsuda2014-08-211-1/+1
|
* Only merge scopes with zero arity in has_many throughAgis-2014-08-201-0/+13
| | | | | | | | | | | | | | | with dynamic conditions. Fixes #16128 This bug was introduced in https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d so it's present from 4.1.2-rc1 and after. https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d merges any relation scopes passed as proc objects to the relation, but does *not* take into account the arity of the lambda. To reproduce: https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
* Merge pull request #15078 from nbudin/fix_merger_filter_binds_comparison_masterRafael Mendonça França2014-05-141-0/+5
|\ | | | | | | | | | | | | Make filter_binds filter out symbols that are equal to strings Conflicts: activerecord/CHANGELOG.md
| * Make filter_binds filter out symbols that are equal to stringsNat Budin2014-05-141-0/+5
|/ | | | | | | | | | | | | ActiveRecord::Relation::Merger's filter_binds method does not filter out bind variables when one of the attribute nodes has a string name, but the other has a symbol name, even when those names are actually equal. This can result in there being more bind variables than placeholders in the generated SQL. This is particularly an issue for PostgreSQL, where this is treated as an error. This patch changes the filter_binds method to make it convert both attribute names to strings before comparing.
* Modify assert conditions not to be affectedYasuo Honda2014-05-121-2/+3
| | | | by each database bind variable naming conventions
* remove the bind substitution visitor. to_sql should never return bind valuesAaron Patterson2014-04-091-3/+1
|
* Merge branch 'master' into set_bindsAaron Patterson2014-01-141-2/+2
|\ | | | | | | | | | | | | | | * master: rm dup code Conflicts: activerecord/test/cases/relations_test.rb
* | where uses bind values so we don't need to manually create themAaron Patterson2014-01-141-11/+3
| |
* | remove test that does not apply anymoreAaron Patterson2014-01-141-12/+1
|/
* use arel nodes to represent non-string `order_values`.Yves Senn2013-11-191-0/+12
| | | | | | | | | | | | | | | | | | | This fixes a bug when merging relations of different classes. ``` Given: Post.joins(:author).merge(Author.order(name: :desc)).to_sql Before: SELECT "posts".* FROM "posts" INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" ORDER BY "posts"."name" DESC After: SELECT "posts".* FROM "posts" INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" ORDER BY "authors"."name" DESC ```
* Address test_merging_where_relations failure by adding `order("posts.id")`Yasuo Honda2013-11-181-1/+1
|
* fix weird Emacs auto indentation. [ci skip]Yves Senn2013-11-131-8/+8
|
* tests for merging Relations of different classes.Yves Senn2013-11-131-0/+19
|
* move Relation#merge tests into separate file.Yves Senn2013-11-131-0/+131