aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
...
| * | `where.not` adds `references` for `includes`.Yves Senn2014-03-171-0/+2
| | | | | | | | | | | | Closes #14406.
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-03-131-2/+13
|\| | | | | | | | | | | | | | | | | * master: passing an instance of an AR object to `find` is deprecated passing an ActiveRecord object to `exists?` is deprecated.
| * | passing an instance of an AR object to `find` is deprecatedAaron Patterson2014-03-131-1/+5
| | | | | | | | | | | | please pass the id of the AR object by calling `.id` on the model first.
| * | passing an ActiveRecord object to `exists?` is deprecated.Aaron Patterson2014-03-131-1/+8
| |/ | | | | | | | | Pass the id of the object to the method by calling `.id` on the AR object.
* | `where` automatically uses bind values nowAaron Patterson2014-03-131-5/+2
| |
* | Merge branch 'master' into adequaterecordAaron Patterson2014-03-132-18/+28
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (108 commits) make tests pass on Ruby 2.2 Use Sqlite3 adapter in examples use the body proxy to freeze headers just ask the response for the commit status, we do not need to ask the jar only write the jar if the response isn't committed Fix a grammatical error in the i18n guide [ci skip] use method_defined? to check whether or not a method is defined Enhance docs for update_attribute [ci-skip] Change usec to 0 on tests that compare seconds Unit test for mysql quote time usec Changelog entry for mysql56 microseconds Test microsecond on mysql 5.6 MySQL 5.6 and later supports microsecond precision in datetime. [ci skip] Add documentation for original_fullpath. Remove mocking on save, when not necessary comment why we are modifying global state. [ci skip] `change_table` supports `citext`. Follow up to #12523. Removed unnecessary command "application" register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester] Fixes STI when 2+ levels deep. ...
| * get rid of intermediate arrays.Yves Senn2014-03-051-2/+3
| | | | | | | | origin: https://github.com/rails/rails/commit/f6aeb8b1a3687c8523e4a56309fe3736011b2935#commitcomment-5569649
| * we only need to support `asc` and `ASC`. No need for mixed cases. #14263Yves Senn2014-03-051-13/+14
| | | | | | | | This is a result of the discussion at https://github.com/rails/rails/pull/14263/files#r10291489
| * Merge pull request #14263 from robin850/allow_passing_string_to_order_hashYves Senn2014-03-051-3/+6
| |\ | | | | | | Follow up of #10732 - Allow string hash values on AR order method
| | * Allow string hash values on AR order methodMarcelo Casiraghi2014-03-041-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Make exists? use bound values.Martin Schürrer2014-03-041-1/+6
| |/ | | | | | | | | | | | | | | | | | | | | 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.
| * [ci skip] correct select examples and doc, ref [522c0fd]Kuldeep Aggarwal2014-03-011-4/+4
| |
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-171-5/+3
|\| | | | | | | | | | | | | | | | | | | * master: Revert "Merge pull request #13344 from ccutrer/fix-from-default-select" No need to use symbols Don't skip tests if they are not broken. Just don't define they Fix typo [ci skip] Resolve encoding issues with arrays of hstore (bug 11135). Fix coffeescript sample [ci skip]
| * Revert "Merge pull request #13344 from ccutrer/fix-from-default-select"Rafael Mendonça França2014-02-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3ea840355409dc205a9e0d027fc09f1452636969, reversing changes made to e4cde5d58cbb09d1843796f96ba86225ff94fe05. 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.
| * No need to use symbolsRafael Mendonça França2014-02-161-3/+3
| |
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-173-37/+149
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (311 commits) Add a missing changelog entry for #13981 and #14035 Revert "Fixed plugin_generator test" implements new option :month_format_string for date select helpers [Closes #13618] add factory methods for empty alias trackers guarantee a list in the alias tracker so we can remove a conditional stop exposing table_joins make most parameters to the AliasTracker required make a singleton for AssociationScope pass the association and connection to the scope method pass the tracker down the stack and construct it in the scope method clean up add_constraints signature remove the reflection delegate remove klass delegator remove railties changes. fixes #14054 remove chain delegate remove scope_chain delegate Add verb to sanitization note fix path shown in mailer's templates updated Travis build status image url fix guide active_support_core_extensions. add Note to String#indent [ci skip] ... Conflicts: activerecord/lib/active_record/associations/join_dependency.rb activerecord/test/cases/associations/association_scope_test.rb
| * guarantee a list in the alias tracker so we can remove a conditionalAaron Patterson2014-02-141-1/+9
| |
| * Return sized enumerator from Batches#find_eachMarc-Andre Lafortune2014-02-051-1/+3
| |
| * Return sized enumerator from Batches#find_in_batchesMarc-Andre Lafortune2014-02-051-4/+9
| |
| * Make arel methods private APIRafael Mendonça França2014-02-011-4/+3
| | | | | | | | | | | | 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.
| * Let `unscope` ignore non Arel scope.where_valuesWashington Luiz2014-01-301-2/+0
| |
| * Merge pull request #13878 from marcandre/leave_my_options_aloneRafael Mendonça França2014-01-301-2/+2
| |\ | | | | | | find_in_batches should not mutate its argument
| | * find_in_batches should not mutate its argumentMarc-Andre Lafortune2014-01-291-2/+2
| | |
| * | docs, `references` is only used with `includes`. Closes #13727.Yves Senn2014-01-301-9/+14
| |/ | | | | | | | | | | | | 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`.
| * Merge pull request #13201 from marcandre/find_in_batch_enumeratorRafael Mendonça França2014-01-291-0/+9
| |\ | | | | | | | | | | | | | | | | | | | | | `find_in_batches` now returns an `Enumerator` Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/batches.rb
| | * `find_in_batches` now returns an `Enumerator` when called without a block, ↵Marc-Andre Lafortune2013-12-061-0/+9
| | | | | | | | | | | | | | | | | | so that it can be chained with other `Enumerable` methods.
| * | Mention find_each in find_in_batches doc [ci skip]Marc-Andre Lafortune2014-01-291-0/+2
| | |
| * | Handle aliased attributes in AR::Relation#select, #order, etc.Tsutomu Kuroda2014-01-291-1/+5
| | | | | | | | | | | | | | | | | | | | | With this we can write `Model#select(:aliased)`, `Model#order(:aliased)`, `Model#reoder(aliased: :desc)`, etc. Supplementary work to 54122067acaad39b277a5363c6d11d6804c7bf6b.
| * | Display value when raising due to unscope() issuesWashington Luiz2014-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Fix `ActiveRecord::RecordNotFound` error message with custom primary keyKuldeep Aggarwal2014-01-251-2/+2
| | |
| * | Ensure AR #second, #third, etc. finders work through associationsJason Meller2014-01-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes two regressions introduced in cafe31a078 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.
| * | prepend table name for `Relation#select` columns.Yves Senn2014-01-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Fail early with "Primary key not included in the custom select clause" in ↵Alexander Balashov2014-01-211-5/+2
| | | | | | | | | | | | | | | find_in_batches 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.
| * | Ensure #second acts like #first AR finderJason Meller2014-01-201-7/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Remove outdated comment.Rafael Mendonça França2014-01-171-1/+0
| | | | | | | | | | | | | | | | | | | | | The code duplication was removed and this comment is pointing to the wrong line. [ci skip]
* | | use a params hash so we know what bind parameters are usedAaron Patterson2014-01-151-1/+1
| | |
* | | reorder bind indexes if joins produced bind valuesAaron Patterson2014-01-141-0/+9
| | |
* | | take in to account existing bind parameters when building the bind listAaron Patterson2014-01-141-21/+20
| | |
* | | unscoping a where should remove bind valuesAaron Patterson2014-01-141-0/+2
| | |
* | | remove dead codeAaron Patterson2014-01-141-2/+0
| | |
* | | where needs to bring the bind params when creating a new relationAaron Patterson2014-01-141-0/+3
| | |
* | | we should not be copying these. fixes ↵Aaron Patterson2014-01-141-4/+0
| | | | | | | | | | | | test_find_all_using_where_with_relation_with_bound_values
* | | fixing column alias resolutionAaron Patterson2014-01-131-1/+1
| | |
* | | do not clear out bind parameters on unscopeAaron Patterson2014-01-131-3/+0
| | |
* | | Merge branch 'master' into set_bindsAaron Patterson2014-01-131-4/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (24 commits) unscope should remove bind values associated with the where reverse_order_value= is not private, so no need to send avoid more dynamic symbols no need to to_sym recover from test runs that leave the database in a bad state updates screenshot data [ci skip] "serie" => "series" revises a few things in the getting started guide [ci skip] Favor canonical environment variables for secrets removed extra comma [ci skip] Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665. Updated Changelog to reflect removal of :dependent => :restrict standardize on jruby_skip & rbx_skip fix bug in becomes! when changing from base to subclass. Closes #13272. highlight http://localhost:3000 in README.md. Closes #13643. [ci skip] doc proc/lambda arg on inclusion validation. Closes #13689. [ci skip] Skip Spring App Generator tests on JRuby fixes a typo in a CHANGELOG upgrade SDoc fixes the Gemfile generator templates ... Conflicts: activerecord/test/cases/hot_compatibility_test.rb
| * | unscope should remove bind values associated with the whereAaron Patterson2014-01-131-0/+2
| | |
| * | reverse_order_value= is not private, so no need to sendAaron Patterson2014-01-131-1/+1
| | | | | | | | | | | | It's not public API, but is not private scoped.
| * | avoid more dynamic symbolsAaron Patterson2014-01-131-1/+1
| | |
| * | no need to to_symAaron Patterson2014-01-131-2/+2
| | |
* | | adding bind values to the manager objectAaron Patterson2014-01-133-3/+8
| | |