- 08 4月, 2014 1 次提交
-
-
由 Lauro Caetano 提交于
The reverse_order method was using a flag to control if the order should be reversed or not. Instead of using this variable just build the reverse order inside its proper method. This implementation was leading to an unexpected behavior when using reverse_order and then applying reorder(nil). Example: Before Post.order(:name).reverse_order.reorder(nil) # => SELECT "posts".* FROM "posts" ORDER BY "posts"."id" DESC After Post.order(:name).reverse_order.reorder(nil) # => SELECT "posts".* FROM "posts"
-
- 07 4月, 2014 1 次提交
-
-
由 Lauro Caetano 提交于
This is necessary because Postgresql doesn't play nice with ORDER BY and no GROUP BY. Fixes #14621.
-
- 18 3月, 2014 1 次提交
-
-
由 Earl St Sauver 提交于
The group method also takes an array, however this isn't immediately clear by reading the source since it delegates this method. If you trace it back to the AREL building you can see that it does support an array. Shoutout to @betovelandia for pointing this out.
-
- 17 3月, 2014 1 次提交
-
-
由 Yves Senn 提交于
Closes #14406.
-
- 15 3月, 2014 1 次提交
-
-
由 Steven Harman 提交于
-
- 14 3月, 2014 2 次提交
-
-
由 Aaron Patterson 提交于
please pass the id of the AR object by calling `.id` on the model first.
-
由 Aaron Patterson 提交于
Pass the id of the object to the method by calling `.id` on the AR object.
-
- 05 3月, 2014 3 次提交
-
-
由 Yves Senn 提交于
This is a result of the discussion at https://github.com/rails/rails/pull/14263/files#r10291489
-
由 Marcelo Casiraghi 提交于
This behavior has almost no performance impact: String not allowed 66.910000 0.030000 66.940000 ( 67.024976) String allowed 69.360000 0.030000 69.390000 ( 69.503096) Benchmarked with http://git.io/Y0YuRw.
- 04 3月, 2014 1 次提交
-
-
由 Martin Schürrer 提交于
When we build a query with an inline value that is a numeric (e.g. because it's out of range for an int4) PostgreSQL doesn't use an index on the column, since it's now comparing numerics and not int4s. This leads to a _very_ slow query. When we use bound parameters instead of inline values PostgreSQL raises numeric_value_out_of_range since no automatic coercion happens.
-
- 01 3月, 2014 1 次提交
-
-
由 Kuldeep Aggarwal 提交于
-
- 17 2月, 2014 2 次提交
-
-
由 Rafael Mendonça França 提交于
This reverts commit 3ea84035, reversing changes made to e4cde5d5. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/query_methods.rb Reason: using `from` without `select` should not change the select list to SELECT * because it can lead different query results. If it is needed to change the table to a subquery or a view you can pass a table alias in the `from` call or use `select('subquery.*')`. Fixes #14049.
-
由 Rafael Mendonça França 提交于
-
- 15 2月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 06 2月, 2014 2 次提交
-
-
由 Marc-Andre Lafortune 提交于
-
由 Marc-Andre Lafortune 提交于
-
- 02 2月, 2014 1 次提交
-
-
由 Rafael Mendonça França 提交于
Since its conception arel was made to be private API of Active Record. If users want to use arel features directly we should provide a way using the Active Record API without exposing the arel implementation.
-
- 31 1月, 2014 1 次提交
-
-
由 Washington Luiz 提交于
-
- 30 1月, 2014 3 次提交
-
-
由 Yves Senn 提交于
There is no gain in `referencing` tables that are not used for preloading. Furthermore it will break if polymorphic associations are invloved. This is because `references_eager_loaded_tables?` uses all `reference_values` to decide wether to `eager_load` or `preload`.
-
由 Marc-Andre Lafortune 提交于
-
由 Marc-Andre Lafortune 提交于
-
- 29 1月, 2014 1 次提交
-
-
由 Tsutomu Kuroda 提交于
With this we can write `Model#select(:aliased)`, `Model#order(:aliased)`, `Model#reoder(aliased: :desc)`, etc. Supplementary work to 54122067.
-
- 27 1月, 2014 1 次提交
-
-
由 Washington Luiz 提交于
Hopefully make it easier to debug errors. e.g Before: RuntimeError: unscope(where: "deleted_at") failed: unscoping String is unimplemented. After: RuntimeError: unscope(where: "deleted_at") failed: unscoping String "'t'='t'" is unimplemented.
-
- 25 1月, 2014 1 次提交
-
-
由 Kuldeep Aggarwal 提交于
-
- 22 1月, 2014 2 次提交
-
-
由 Jason Meller 提交于
This commit fixes two regressions introduced in cafe31a0 where newly created finder methods #second, #third, #forth, and #fifth caused a NoMethodError error on reload associations and where we were pulling the wrong element out of cached associations. Examples: some_book.authors.reload.second # Before # => NoMethodError: undefined method 'first' for nil:NilClass # After # => #<Author id: 2, name: "Sally Second", ...> some_book.first.authors.first some_book.first.authors.second # Before # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 1, name: "Freddy First", ...> # After # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 2, name: "Sally Second", ...> Fixes #13783.
-
由 Yves Senn 提交于
This fixes a bug where `select(:id)` combined with `joins()` raised: ``` ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: id: SELECT id, authors.author_address_id FROM "posts" INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" ORDER BY posts.id LIMIT 3 ``` The `select_values` are still String and Symbols because other parts (mainly calculations.rb) rely on that fact. /cc @tenderlove
-
- 21 1月, 2014 2 次提交
-
-
由 Alexander Balashov 提交于
Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
-
由 Jason Meller 提交于
This commit bring the famous ordinal Array instance methods defined in ActiveSupport into ActiveRecord as fully-fledged finders. These finders ensure a default ascending order of the table's primary key, and utilize the OFFSET SQL verb to locate the user's desired record. If an offset is defined in the query, calling #second adds to the offset to get the actual desired record. Fixes #13743.
-
- 14 1月, 2014 4 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
It's not public API, but is not private scoped.
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 10 1月, 2014 1 次提交
-
-
由 Yves Senn 提交于
Refs #13658
-
- 30 12月, 2013 1 次提交
-
-
由 Kuldeep Aggarwal 提交于
-
- 20 12月, 2013 1 次提交
-
-
由 Cody Cutrer 提交于
-
- 18 12月, 2013 1 次提交
-
-
由 Akshay Vishnoi 提交于
-
- 17 12月, 2013 2 次提交
-
-
由 Lauro Caetano 提交于
This change was necessary because the whitelist wouldn't work. It would be painful for users trying to update their applications. This blacklist intent to prevent odd bugs and confusion in code that call mutator methods directely on the `Relation`.
-
由 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")
-
- 16 12月, 2013 1 次提交
-
-
由 Akshay Vishnoi 提交于
-