- 16 8月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
If handled as an associated predicate even though a table has the column, will generate invalid SQL by valid column name treated as a table name.
-
- 07 8月, 2016 2 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
-
- 17 2月, 2016 1 次提交
-
-
由 Philippe Huibonhoa 提交于
When passing in an array of different types of objects to `where`, it would only take into account the class of the first object in the array. PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)]) # => SELECT "price_estimates".* FROM "price_estimates" WHERE ("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" IN (1, 2)) This is fixed to properly look for any records matching both type and id: PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)]) # => SELECT "price_estimates".* FROM "price_estimates" WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1) OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
-
- 17 10月, 2015 1 次提交
-
-
由 yui-knk 提交于
-
- 16 10月, 2015 1 次提交
-
-
由 Jake Worth 提交于
[#20473]
-
- 02 10月, 2015 1 次提交
-
-
由 Guo Xiang Tan 提交于
-
- 04 2月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
While we query the proper columns, we go through normal handling for converting the value to a primitive which assumes it should use the table's primary key. If the association specifies a different value (and we know that we're working with an association), we should use the custom primary key instead. Fixes #18813.
-
- 20 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
With the old implementation, the bind values were created, and then we search the attributes for `Relation` objects, and merge them. This completely ignores the order that the actual `where` clause will use. If all non-relation where parameters are before the relations, it will work. However, if we query on both a relation and a value, with the value coming second, it breaks. The order of the hash should not affect the final query (especially since hashes being ordered is an implementation detail)
-
- 10 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
This is cropping up all over the place. After a brief dive, I'm really not sure why we have `arel.bind_values` at all. A cursory grep didn't reveal where they're actually being assigned (it's definitely in AR, not in Arel). I'd like to dig further into it, as I'm fairly certain we don't actually need it, we just need a way for the predicate builder to communicate merged binds upstream. Fixes #18414
-
- 05 12月, 2014 1 次提交
-
-
由 Melanie Gilman 提交于
-
- 02 11月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
It was transitively relying on the vertex model being loaded
-
- 07 9月, 2014 1 次提交
-
-
由 Cristian Bica 提交于
`User.where(id: [[1,2],3])` was equal to `User.where(id:[1, 2, 3])` in Rails 4.1.x but because of some refactoring in Arel this stopped working in 4.2.0. This fixes it in Rails. [Dan Olson & Cristian Bica]
-
- 17 8月, 2014 1 次提交
-
-
由 Jean Boussier 提交于
Post.where(id: [[]]).to_a Used to fail with a SQL syntax error (until 4.1): SELECT ... WHERE id in (); It now properly generate: SELECT ... WHERE 1=0;
-
- 14 8月, 2014 1 次提交
-
-
由 Bogdan Gusiev 提交于
Example: Author.where(posts: { author_id: Author.where(country_id: 1) }).joins(:posts)
-
- 06 7月, 2014 1 次提交
-
-
由 Dylan Thacker-Smith 提交于
-
- 17 12月, 2013 1 次提交
-
-
由 Martin Emde 提交于
Using the name of an association in `where` previously worked only if the value was a single `ActiveRecrd::Base` object. e.g. Post.where(author: Author.first) Any other values, including `nil`, would cause invalid SQL to be generated. This change supports arguments in the `where` query conditions where the key is a `belongs_to` association name and the value is `nil`, an `Array` of `ActiveRecord::Base` objects, or an `ActiveRecord::Relation` object. # Given the Post model class Post < ActiveRecord::Base belongs_to :author end # nil value finds records where the association is not set Post.where(author: nil) # SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IS NULL # Array values find records where the association foreign key # matches the ids of the passed ActiveRecord models, resulting # in the same query as Post.where(author_id: [1,2]) authors_array = [Author.find(1), Author.find(2)] Post.where(author: authors_array) # ActiveRecord::Relation values find records using the same # query as Post.where(author_id: Author.where(last_name: "Emde")) Post.where(author: Author.where(last_name: "Emde")) Polymorphic `belongs_to` associations will continue to be handled appropriately, with the polymorphic `association_type` field added to the query to match the base class of the value. This feature previously only worked when the value was a single `ActveRecord::Base`. class Post < ActiveRecord::Base belongs_to :author, polymorphic: true end Post.where(author: Author.where(last_name: "Emde")) # Generates a query similar to: Post.where(author_id: Author.where(last_name: "Emde"), author_type: "Author")
-
- 03 11月, 2013 1 次提交
-
-
由 David Heinemeier Hansson 提交于
-
- 27 8月, 2013 1 次提交
-
-
由 Mikhail Dieterle 提交于
add changelog entry for #11945
-
- 02 5月, 2013 1 次提交
-
-
由 Godfrey Chan 提交于
When using symbol keys, ActiveRecord will now translate aliased attribute names to the actual column name used in the database: With the model class Topic alias_attribute :heading, :title end The call Topic.where(heading: 'The First Topic') should yield the same result as Topic.where(title: 'The First Topic') This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`. This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`. Github #7839 *Godfrey Chan*
-
- 28 2月, 2013 1 次提交
-
-
由 Steve Klabnik 提交于
This reverts commit 408227d9, reversing changes made to dca0b57d.
-
- 09 2月, 2013 2 次提交
-
-
由 Guillermo Iguaran 提交于
-
由 Guillermo Iguaran 提交于
-
- 08 2月, 2013 2 次提交
-
-
由 robertomiranda 提交于
-
由 robertomiranda 提交于
-
- 07 2月, 2013 1 次提交
-
-
由 Dylan Smith 提交于
-
- 25 1月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 09 1月, 2013 3 次提交
-
-
由 Carlos Antonio da Silva 提交于
-
由 Aaron Patterson 提交于
* Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu Conflicts: actionpack/CHANGELOG.md actionpack/lib/action_dispatch/http/request.rb actionpack/lib/action_dispatch/middleware/params_parser.rb activerecord/CHANGELOG.md activerecord/lib/active_record/relation/predicate_builder.rb activerecord/test/cases/relation/where_test.rb
-
由 Jeremy Kemper 提交于
This reverts commit 88cc1688, reversing changes made to f049016c.
-
- 08 1月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
* Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu Conflicts: actionpack/CHANGELOG.md actionpack/lib/action_dispatch/http/request.rb actionpack/lib/action_dispatch/middleware/params_parser.rb activerecord/CHANGELOG.md activerecord/lib/active_record/relation/predicate_builder.rb activerecord/test/cases/relation/where_test.rb
-
- 07 12月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
This test does not belong to has many associations test.
-
- 19 9月, 2012 1 次提交
-
-
由 Damien Mathieu 提交于
Closes #6960
-
- 13 9月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
Previously the reflection would be looked up on the wrong class. However the test passed because the examples referred back to themselves.
-
- 12 9月, 2012 1 次提交
-
-
由 beerlington 提交于
Allows you to specify the model association key in a belongs_to relationship instead of the foreign key. The following queries are now equivalent: Post.where(:author_id => Author.first) Post.where(:author => Author.first) PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) PriceEstimate.where(:estimate_of => treasure)
-
- 31 5月, 2012 1 次提交
-
-
由 Aaron Patterson 提交于
Thanks to Ben Murphy for reporting this CVE-2012-2661
-