aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader
Commit message (Collapse)AuthorAgeFilesLines
* Return a null column from `column_for_attribute` when no column exists.Rafael Mendonça França2015-01-041-2/+2
| | | | | | | | This reverts commit ae96f229f6501d8635811d6b22d75d43cdb880a4. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods.rb
* Go through normal `where` logic when preloading associationsSean Griffin2014-12-261-1/+1
| | | | | | | | | | This will allow eager type casting to take place as needed. There doesn't seem to be any particular reason that the `in` statement was forced for single values, and the commit message where it was introduced gives no context. See https://github.com/rails/rails/commit/d90b4e2615e8048fdeffc6dffe3246704adee01f
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Fix includes on association with a scope containing joins along with conditionssiddharth@vinsol.com2014-11-211-8/+2
| | | | on the joined assoiciation
* Merge pull request #17360 from bronzle/includes_and_unscopedYves Senn2014-11-051-0/+1
|\ | | | | | | copy reflection_scopes’s unscoped value when building scope for preloading
| * copy reflection_scopes’s unscoped value when building scope for ↵Byron Bischoff2014-10-221-0/+4
| | | | | | | | preloading, fixes #11036
* | Use bind values for joined tables in where statementsSean Griffin2014-11-011-0/+1
|/ | | | | | | | | | | | | | | In practical terms, this allows serialized columns and tz aware columns to be used in wheres that go through joins, where they previously would not behave correctly. Internally, this removes 1/3 of the cases where we rely on Arel to perform type casting for us. There were two non-obvious changes required for this. `update_all` on relation was merging its bind values with arel's in the wrong order. Additionally, through associations were assuming there would be no bind parameters in the preloader (presumably because the where would always be part of a join) [Melanie Gilman & Sean Griffin]
* Spelling errorsjbsmith862014-08-141-1/+1
|
* `preload` preserves readonly flag on associations. #15853Yves Senn2014-06-251-0/+4
| | | | | | This is a partial fix for #15853. It only works when a `preload` is issued and not an `eager_load`. I've added a skipped failing test-case to keep in mind that we need to deal with `eager_load`.
* Add a deprecation cycle for `NullColumn` from `column_for_attribute`Sean Griffin2014-06-231-2/+2
| | | | | | This is public API, and `simple_form` depends on the `nil` return value. We need to go through a deprecation cycle to return a null object. If people want hash access, they can access the hash.
* Use null column for association key typesSean Griffin2014-06-041-4/+2
|
* Fix regression on eager loading association based on SQL query ratherLauro Caetano2014-06-031-2/+4
| | | | | | than existing column. Fixes #15480.
* Merge pull request #14855 from laurocaetano/fix_polymorphic_with_string_keyYves Senn2014-05-211-4/+25
|\ | | | | | | Fix polymorphic eager load with foreign_key as String.
| * Fix polymorphic eager load with foreign_key as String.Lauro Caetano2014-05-201-2/+17
|/ | | | | | | | | The foreign_key could be `String` and just doing `owners_map[owner_key]` could return `nil`. To prevent this bug, we should `to_s` both keys if their types are different. Fixes #14734.
* Merge branch 'master' into adequaterecordAaron Patterson2014-04-252-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (28 commits) move AR length validation tests into separate test-case. No need for trailing slash on migration path. reset `@arel` when modifying a Relation in place. PostgreSQL Timestamps always map to `:datetime`. [ci skip] Improve formatting and yml Fix a typo in the doc of forty_two AR FinderMethod Improve readability of contributing to rails guide. [ci skip] Precompile the image we're referencing, too. `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions. Fixed an issue with migrating legacy json cookies. Correct comment [ci skip] Perfer to define methods instead of calling test Fix syntax error Add CHANGELOG entry for #14757 [ci skip] Fix run-on sentences and improve grammar [skip ci] Add test for using ActionView::Helpers::FormHelper.label with block and html select! renamed to avoid name collision Array#select! Rearrange deck chairs on the titanic. Organize connection handling test cases. Change favicon_link_tag helper mimetype from image/vnd.microsoft.icon to image/x-icon. ActionController::Renderers documentation fix ...
| * reset `@arel` when modifying a Relation in place.Yves Senn2014-04-241-1/+1
| | | | | | | | /cc @tenderlove
| * select! renamed to avoid name collision Array#select!Earl J St Sauver2014-04-211-1/+1
| | | | | | | | | | | | | | | | Fixes #14752 Select mimics the block interface of arrays, but does not mock the block interface for select!. This change moves the api to be a private method, _select!.
* | Merge branch 'master' into adequaterecordAaron Patterson2014-03-131-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. ...
| * Replace map.flatten with flat_map in activerecordErik Michaels-Ober2014-03-031-1/+1
| |
* | Merge branch 'master' into set_bindsAaron Patterson2014-01-116-116/+106
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (2794 commits) doc, API example on how to use `Model#exists?` with multiple IDs. [ci skip] Restore DATABASE_URL even if it's nil in connection_handler test [ci skip] - error_messages_for has been deprecated since 2.3.8 - lets reduce any confusion for users Ensure Active Record connection consistency Revert "ask the fixture set for the sql statements" Check `respond_to` before delegation due to: https://github.com/ruby/ruby/commit/d781caaf313b8649948c107bba277e5ad7307314 Adding Hash#compact and Hash#compact! methods MySQL version 4.1 was EOL on December 31, 2009 We should at least recommend modern versions of MySQL to users. clear cache on body close so that cache remains during rendering add a more restricted codepath for templates fixes #13390 refactor generator tests to use block form of Tempfile Fix typo [ci skip] Move finish_template as the last public method in the generator Minor typos fix [ci skip] make `change_column_null` reversible. Closes #13576. create/drop test and development databases only if RAILS_ENV is nil Revert "Speedup String#to" typo fix in test name. [ci skip]. `core_ext/string/access.rb` test what we are documenting. Fix typo in image_tag documentation ... Conflicts: activerecord/lib/active_record/associations/join_dependency/join_association.rb activerecord/lib/active_record/relation/query_methods.rb
| * remove the nil check from set_inverse_instanceAaron Patterson2013-12-121-1/+1
| | | | | | | | | | methods that call set_inverse_instance with a record will not have to pay the cost of a nil check on every call
| * read the association instead of sendingAaron Patterson2013-10-141-1/+3
| |
| * simplify populating the ordering hashAaron Patterson2013-10-141-10/+5
| |
| * the preloader for the RHS has all the preloaded records, so ask itAaron Patterson2013-10-141-3/+3
| |
| * only calculate offset index once. #12537Aaron Patterson2013-10-141-6/+10
| |
| * Drop unused iterator varVipul A M2013-10-131-1/+1
| |
| * remove the HABTM preloaderAaron Patterson2013-10-021-71/+0
| |
| * remove initialize methodAaron Patterson2013-09-251-4/+0
| |
| * extract association resetting to a methodAaron Patterson2013-09-251-9/+16
| |
| * hash insertion order doesn't matter anymore, so only loop over theAaron Patterson2013-09-251-4/+2
| | | | | | | | owners once
| * always populate the preloaded records instance variable so we can removeAaron Patterson2013-09-252-10/+5
| | | | | | | | the @associated_records_by_owner ivar
| * keep preloaded records in a list rather than extract from a hashAaron Patterson2013-09-253-16/+21
| |
| * push slice loading to it's own method so we can remove the type castingAaron Patterson2013-09-242-24/+20
| | | | | | | | code
| * guarantee that `klass` is not nil inside the preloader objectsAaron Patterson2013-09-241-1/+1
| |
| * eliminate unused ivarAaron Patterson2013-09-241-1/+0
| |
| * all records have a preloaded, so eliminate that conditionalAaron Patterson2013-09-241-11/+7
| |
| * eliminate the `loaded?` conditionalAaron Patterson2013-09-242-10/+1
| |
| * push preloaded test up to the factory method so we can eliminateAaron Patterson2013-09-242-6/+4
| | | | | | | | conditionals from the individual preloaded classes
| * we can't sort by lhs since the middle records have difference classesAaron Patterson2013-09-231-19/+19
| | | | | | | | and possibly different rules for finding those objects
| * pass the preloader down so we only have to construct oneAaron Patterson2013-09-236-19/+17
| |
| * remove state from the preloaderAaron Patterson2013-09-231-10/+9
| |
| * only do the should_reset test onceAaron Patterson2013-09-231-6/+6
| |
| * fix variable names and speed up relation orderingAaron Patterson2013-09-232-16/+12
| |
| * hm:t preloading will respect order set on the RHS associationAaron Patterson2013-09-234-7/+52
| |
| * cache associated target records hashAaron Patterson2013-09-201-17/+11
| |
| * combine methods so we can reuse preloadersAaron Patterson2013-09-201-19/+18
| |
| * return a list rather than hashAaron Patterson2013-09-201-7/+13
| |
| * preserve order on the RHS queryAaron Patterson2013-09-201-0/+8
| |
| * split up construction and mutationAaron Patterson2013-09-201-1/+4
| |
| * push `run` up to preloadAaron Patterson2013-09-202-4/+11
| |