aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
Commit message (Collapse)AuthorAgeFilesLines
* Ensure AR #second, #third, etc. finders work through associationsJason Meller2014-01-211-61/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* `has_one` and `belongs_to` accessors don't add ORDER BY to the queries anymore.Rafael Mendonça França2014-01-212-0/+14
| | | | | | | | | | Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent results among different database engines. But for singular associations this behavior is not needed since we will have one record to return. As this ORDER BY option can lead some performance issues we are removing it for singular associations accessors. Fixes #12623.
* Extract a method to simplify setup codeCarlos Antonio da Silva2014-01-161-23/+27
|
* Use minitest's skip rather than conditionals + early returnsCarlos Antonio da Silva2014-01-161-47/+38
|
* Move AR test classes inside the test caseCarlos Antonio da Silva2014-01-161-38/+46
|
* Remove method redefined warnings for test suiteMatthias Zirnstein2014-01-051-1/+1
| | | | | | | | | | | | | | | | | has_many definitions with "name" as singular and as plural e.g. has_many :welcome_posts_with_comment has_many :welcome_posts_with_comments Ruby mentions it with: lib/active_record/associations/builder/collection_association.rb:65: warning: method redefined; discarding old welcome_posts_with_comment_ids lib/active_record/associations/builder/collection_association.rb:65: warning: previous definition of welcome_posts_with_comment_ids was here lib/active_record/associations/builder/collection_association.rb:75: warning: method redefined; discarding old welcome_posts_with_comment_ids= lib/active_record/associations/builder/collection_association.rb:75: warning: previous definition of welcome_posts_with_comment_ids= was here
* Merge pull request #10134 from ↵Rafael Mendonça França2014-01-031-1/+5
|\ | | | | | | | | derikson/collection_proxy_select_with_multiple_args Change CollectionProxy#select to take the same arguments as ActiveRecord::select
| * Changed ActiveRecord::Associations::CollectionProxy#select to take multiple ↵Dan Erikson2013-04-081-1/+5
| | | | | | | | | | | | arguments. This makes the arguments the same as ActiveRecord::QueryMethods::select.
* | Improve the tests to not call assert_nothing_raisedRafael Mendonça França2014-01-011-4/+1
| |
* | https://github.com/rails/rails/commit/2075f39d726cef361170218fd16421fc52bed5 ↵Vipul A M2013-12-311-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a8 introduced a regression in includes/preloades by calling `read_attribute` on an association when preloading takes places, instead of using loaded records in `association.target`. tl;dr Records are not made properly available via `read_attribute` when preloding in simultaneous, but value of `@loaded` is already set true, and records concatenated in `association.target` on an association object. When `@loaded` is true we return an object of `AlreadyLoaded` in preload_for. In `AlreadyLoaded` to return preloaded records we make wrong use of `read_attribute`, instead of `target` records. The regression is fixed by making use of the loaded records in `association.target` when the preloading takes place. Fixes #13437
* | On destroying do not touch destroyed belongs to association.Paul Nikitochkin2013-12-231-0/+8
| | | | | | | | Fixes: #13445
* | Prefer assert_raise instead of flunk + rescue to test for exceptionsCarlos Antonio da Silva2013-12-191-5/+3
| | | | | | | | | | | | Change most tests to make use of assert_raise returning the raised exception rather than relying on a combination of flunk + rescue to check for exception types/messages.
* | Add a failing test for assigning nil to a polymorphic belongs_to not ↵Jeremy Kemper2013-12-171-0/+13
| | | | | | | | nullifying its _type column
* | make sure cached table name is a string. fixes #12582Aaron Patterson2013-12-121-0/+7
| |
* | Revert the whole refactoring in the association builder classes.Rafael Mendonça França2013-12-111-1/+2
| | | | | | | | This is to get activerecord-deprecated_finders work again
* | Raise `ArgumentError` when `has_one` is used with `counter_cache`Godfrey Chan2013-11-292-0/+16
| | | | | | | | | | | | | | | | | | Previously, the `has_one` macro incorrectly accepts the `counter_cache` option due to a bug, although that options was never supported nor functional on `has_one` and `has_one ... through` relationships. It now correctly raises an `ArgumentError` when passed that option. For reference, this bug was introduced in 52f8e4b9.
* | updating options documentation for associationsKuldeep Aggarwal2013-11-291-8/+3
| | | | | | | | removed unnecessary test case and improved test case for belongs_to having invalid options
* | changed update counter to act on unscoped modelheruku2013-11-261-0/+8
| |
* | Raise `RecordNotDestroyed` when children can't be replacedBrian Thomas Storti2013-11-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #12812 Raise `ActiveRecord::RecordNotDestroyed` when a child marked with `dependent: destroy` can't be destroyed. The following code: ```ruby class Post < ActiveRecord::Base has_many :comments, dependent: :destroy end class Comment < ActiveRecord::Base before_destroy do return false end end post = Post.create!(comments: [Comment.create!]) post.comments = [Comment.create!] ```` would result in a `post` with two `comments`. With this commit, the same code would raise a `RecordNotDestroyed` exception, keeping the `post` with the same `comment`.
* | Fix some minor typos [ci skip]Vipul A M2013-11-261-1/+1
| |
* | Fix ActiveRecord::Relation#unscopeJon Leighton2013-11-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm pretty confused about the addition of this method. The documentation says that it was intended to allow the removal of values from the default scope (in contrast to #except). However it behaves exactly the same as except: https://gist.github.com/jonleighton/7537008 (other than having a slightly enhanced syntax). The removal of the default scope is allowed by 94924dc32baf78f13e289172534c2e71c9c8cade, which was not a change we could make until 4.1 due to the need to deprecate things. However after that change #unscope still gives us nothing that #except doesn't already give us. However there *is* a desire to be able to unscope stuff in a way that persists across merges, which would allow associations to be defined which unscope stuff from the default scope of the associated model. E.g. has_many :comments, -> { unscope where: :trashed } So that's what this change implements. I've also corrected the documentation. I removed the guide references to #except as I think unscope really supercedes #except now. While we're here, there's also a potential desire to be able to write this: has_many :comments, -> { unscoped } However, it doesn't make sense and would not be straightforward to implement. While with #unscope we're specifying exactly what we want to be removed from the relation, with "unscoped" we're just saying that we want it to not have some things which were added earlier on by the default scope. However in the case of an association, we surely don't want *all* conditions to be removed, otherwise the above would just become "SELECT * FROM comments" with no foreign key constraint. To make the above work, we'd have to somehow tag the relation values which get added when evaluating the default scope in order to differentiate them from other relation values. Which is way too much complexity and therefore not worth it when most use cases can be satisfied with unscope. Closes #10643, #11061.
* | Merge pull request #12918 from versioncontrol/rails-12866Rafael Mendonça França2013-11-161-0/+4
|\ \ | | | | | | | | | | | | | | | | | | Checks to see if the record contains the foreign_key to set the inverse automatically Conflicts: activerecord/CHANGELOG.md
| * | Checks to see if the record contains the foreign_key to set the inverse ↵Edo Balvers2013-11-161-0/+4
| | | | | | | | | | | | automatically
* | | Fix test name [ci skip]Carlos Antonio da Silva2013-11-141-1/+1
| | |
* | | Fix that eager loading of polymorphic associations did not work with ↵David Heinemeier Hansson2013-11-142-3/+1
| | | | | | | | | | | | association empty?/any? predicates any more (there is still a problem when select is applied to a relation, or if you try association#exists? -- but its easier to work around)
* | | Prevent the counter cache from being decremented twicedm1try2013-11-111-0/+9
| | | | | | | | | | | | | | | when destroying a record on a has_many :through association. :destroy method has own counter_cache callbacks.
* | | Fixes problem with replacing has_one association record with itselfDenis Redozubov2013-11-111-2/+16
| | |
* | | Mark broken test as pendingRafael Mendonça França2013-11-081-0/+2
|/ / | | | | | | This will avoid the broken window effect in our test suite
* | Fix wrong behavior where associations with dependent: :destroy optionsRafael Mendonça França2013-11-011-4/+3
| | | | | | | | | | | | | | | | | | was using nullify strategy This caused a regression in applications trying to upgrade. Also if the user set the dependent option as destroy he expects to get the records removed from the database.
* | Test with the right associationRafael Mendonça França2013-11-011-3/+3
| |
* | :cut: whitespaceAaron Patterson2013-10-301-2/+2
| |
* | Fix broken delete_all test, which will now be failing since #delete_all is ↵David Heinemeier Hansson2013-10-281-4/+4
| | | | | | | | broken
* | Add failing test for preloading with a polymorphic association and using the ↵David Heinemeier Hansson2013-10-281-1/+10
| | | | | | | | existential predicate
* | Assert the return value in the testRafael Mendonça França2013-10-271-1/+1
| |
* | Skip `include_values` from through associations chains for building target scopePaul Nikitochkin2013-10-271-0/+4
| | | | | | | | Fixes: #12242, #9517, #10240
* | Merge pull request #12621 from ↵Rafael Mendonça França2013-10-241-0/+11
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | laurocaetano/fix_has_one_association_with_primary_key_set Save association when primary key is manually set Conflicts: activerecord/CHANGELOG.md
| * | Save association when primary key is manually setlaurocaetano2013-10-241-0/+11
| | |
* | | Merge branch 'master' into joindepAaron Patterson2013-10-151-0/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (44 commits) grammar fix (reverted in e9a1ecd) Revert "fixed a doc bug in the CHANGELOG.md s/does no longer depend on/no longer depends on/" Add missed require making `enable_warnings` available Prepare generated Gemfile for Capistrano 3 Added --model-name option scaffold_controller_generator. read the association instead of sending we should have unique sponsorable ids in the fixtures at least simplify populating the ordering hash the preloader for the RHS has all the preloaded records, so ask it only calculate offset index once. #12537 Remove size alias for length validation Fix `singleton_class?` Minor Refactoring to `NumberHelper#number_to_human` `$SAFE = 4;` has been removed with Ruby 2.1 scope_chain should not be mutated for other reflections Remove `default_primary_key_type` and extract contains of `native_database_types` to a constant since they aren't conditional now in SQLite3Adapter. Makes it more like other adapters. cleanup changelog entry format. [ci skip] Extract a function to determine if the default value is a function Push default_function to superclass to avoid method check Dump the default function when the primary key is uuid ... Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
| * | inversed instance should not be reloaded after stale state was changedDmitry Polushkin2013-10-131-0/+12
| | | | | | | | | check at association reader that record is inverted and should not be reloaded because of stale was changed at target record
* | | this method does not exist anymoreAaron Patterson2013-10-141-8/+0
|/ /
* | Merge branch 'builder-instances'Rafael Mendonça França2013-10-091-2/+1
|\ \
| * | Define the association extensions without need to have a builderRafael Mendonça França2013-10-091-2/+1
| | | | | | | | | | | | instance
* | | Using flat_map instead of map and flattenArun Agrawal2013-10-091-1/+1
|/ / | | | | | | | | | | original commit 8998441967a8cfc6e4302c29664ab9d0acd77704 Reverted here ec8ef1e1055c4e1598da13f49d30261f07f4a9b4
* | add regression test for set_inverse_instance on add_to_targetArthur Neves2013-10-041-0/+13
| |
* | preheat habtm column cacheAaron Patterson2013-10-021-0/+1
| |
* | Squashed commit of the following:Aaron Patterson2013-10-013-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 02d3b059608c30e98136fde78bc710928f080566 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 30 15:31:39 2013 -0700 habtm works in terms of hm:t commit 71ac336bbb41f5047a4ee307883a95eca7195742 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 30 15:27:07 2013 -0700 passing before_add callbacks commit d846a7bf9872a79c3aa8082917abe806278fa159 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 17:57:53 2013 -0700 reducing diff against master commit 96bd97de47d61a71c368ae367bc59a2dbec3c9ab Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 17:52:35 2013 -0700 fixing more tests commit 0620399fc231df87c5f08664db1c37e5c1fa5a05 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 17:32:52 2013 -0700 self-referential tables in hm:t are allowed to have the same pk commit 48eb90e27921d10b6ba3e400ab2c784ed75d5ec4 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 17:03:19 2013 -0700 translating more options commit 5cace7b2cb546fd6b096543bfc49c4b7197ad21a Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 17:01:02 2013 -0700 handling more hm:t cases commit 69985ca2cabff2c3f58f5d0a7eb12d7b414c1a01 Merge: d417ec8 3e0a60e Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 27 16:57:12 2013 -0700 Merge branch 'master' into rmhbtm * master: (21 commits) adding a test to demonstrate how to use STI subclasses on the far right side of a hm:t association along with preloading. Fixed grammatical typo in configuring.md guide. Getting Started Guide: Fix code container in Chapter 5.2 [ci-skip] Getting Started Guide: Update sentence in Chapter 5.8 [ci-skip] Add new line after create action on CommentsController code example Adds template dependencies rake task from cache_digests gem. [ci skip] Update scaffold output and change some words. [ci skip] escape unintended url in docs Getting Started Guide: post.rb -> Post [ci skip] Add missing periods and update link name and some wording. quote `false` reference in querying guide. Getting Started Guide: update link_to string argument to use single-quote mark, following document style [ci skip] Fix small typo in docs changelog entry fix .find when inverse is set update changelog for #12359 Make sure inverse_of is visible on the has_many callbacks Getting Started Guide: posts_controller -> PostsController [ci skip] [ci skip] Correct the explanation of the example for find_or_create_by when used with create_with in ActiveRecord Querying guide added "id: false" to HABTM join table example ... commit d417ec82e8f83c32124d1c1a19824d023cfdf015 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 25 16:49:08 2013 -0700 another case is passing commit 5c68280500962e4b2b6819dd863ebe8b398e5834 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 25 16:21:22 2013 -0700 this seems to work commit e458c5e55c04a2444e96aca1ff192be42bc4ce7f Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 25 16:13:07 2013 -0700 add another case commit fc6203b0d49c847b8efb1cc33d358897625f2115 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 25 15:51:45 2013 -0700 delete center records on habtm commit 9af5156098f6bc8f8ce8eb559a51137960b4938b Merge: 3a60b03 e2fd64f Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 25 11:33:13 2013 -0700 Merge branch 'master' into rmhbtm * master: (100 commits) remove initialize method extract association resetting to a method hash insertion order doesn't matter anymore, so only loop over the owners once always populate the preloaded records instance variable so we can remove the @associated_records_by_owner ivar keep preloaded records in a list rather than extract from a hash Getting Started Guide: Hello Rails! -> Hello, Rails! and wrap code tag push slice loading to it's own method so we can remove the type casting code Add CHANGELOG entry for #12344 Add regression test to #12343 Fix typo in number_to_human docs: you -> your guarantee that `klass` is not nil inside the preloader objects [Documentation] Add a missing validation to I18n docs Use the given name in html_options for the hidden field in collection_check_boxes eliminate unused ivar all records have a preloaded, so eliminate that conditional eliminate the `loaded?` conditional push preloaded test up to the factory method so we can eliminate conditionals from the individual preloaded classes assign_attributes should return if argument is blank. No need the else clause Use join to concat the both side of the AST ... commit 3a60b038a40532397b6c204dfb09d6d43a9336ac Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 17:50:11 2013 -0700 start with a clean slate commit f30d3631af11ea6144d3ae7a068a7c0072e93a82 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 17:30:59 2013 -0700 make sure the class name goes on the rhs belongs_to commit f7516b724014504ddb2e706fea1b5438dc5332c3 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 16:31:40 2013 -0700 remove unused variable commit 61ffc5b9854dc2fe83ee502b17ba8028270ff8a7 Merge: 6cf41cd 460eb83 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 16:25:17 2013 -0700 Merge branch 'master' into rmhbtm * master: support objects with blank string primary keys ActiveRecord::Base#<=> has been removed. Primary keys may not be in order, or even be numbers, so sorting by id doesn't make sense. Please use `sort_by` and specify the attribute you wish to sort with. For example, change: do what the superclass does in the case that objects do not match commit 6cf41cd98a82e6f4fe6d868ad323df3d72a9748f Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 15:06:28 2013 -0700 heating up habtm cache commit d7f6c3aa491f27ba71fdb2b9d0b9d1780664f4dc Merge: c68c904 56bfd8a Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 18 14:07:51 2013 -0700 Merge branch 'master' into rmhbtm * master: (58 commits) Fix an issue where router can't recognize downcased url encoding path. There's no need to do this Remove tzinfo dependency from Action Pack [ci skip] Improve readability of 4.3's NOTE in migration.md. Removes unused code related to DatabaseTasks. [ci skip] Consistency wording of 9.6 in form_helpers.md [ci skip] Update plugins.md Removing ActiveSupport::Concern, it's not needed Fixing comment typo in ActionController::Base Don't require using application_name before options Collapse where constraints to one where constraint Custom flash should be defined only for the class that defines it and it's subclasses. Fix typos: the indefinite articles(a -> an) Missing destroy command Update 3_2_release_notes.md Add CHANGELOG entry for #11698 Add CHANGELOG entry for #12149 Use the Rails binary when generating task Remove unnecessary loop "generates" applies to "collection radio" so it should be singular ... commit c68c904866ef9562c3bd9b54574206a416184414 Merge: 0f5d8e0 71cf717 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 11 17:45:53 2013 -0700 Merge branch 'master' into rmhbtm * master: these are not real developer objects, so counting them doesn't make sense. Let's load the object to ensure it's an array and count the array. Remove conditional adding a new method Fix inverted conditional Remove invalid comment Check if the SQL is not a prepared statement Whitespaces Revert "Add meta tag with charset information to application layout." Avoid empty transaction from setting has_one association on new record. Reduce Duration#inspect to a single series of transformations Relation#merge should not lose readonly(false) flag. Reduce allocations when extracting AR models Perf: avoid dupes add fallback logic for coders commit 0f5d8e0febd3128cf4121ff36f1764b9284d9f7d Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 11 11:43:29 2013 -0700 everything works with extensions commit d003c103b5908fb3a6427f39bddd1748ef2c2576 Merge: 5768c38 7e0cac1 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Wed Sep 11 11:23:59 2013 -0700 Merge branch 'master' into rmhbtm * master: fix deleting join models with no pk remove sentence err [ci skip] 'previous version of Rails' is gramatically incorrect Add meta tag with charset information to application layout. add a comment for sanity of other people to come commit 5768c38d53fd66a97814faaea8e07c70722b310f Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Tue Sep 10 15:11:05 2013 -0700 habtms with a scope seem to be working commit 5ee9108d95c544d4befd682a72139383d0780d68 Merge: d5478e6 e64b5da Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Tue Sep 10 11:55:48 2013 -0700 Merge branch 'master' into rmhbtm * master: ask the association for records rather than calling `send` commit d5478e64bbf80337ec35462368edabb373feeb74 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Tue Sep 10 11:54:39 2013 -0700 ask the association for records rather than calling `send` commit 93020bc1ad51363c3f400370f91c9494690dcea8 Merge: 11b3d5f d68419a Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Tue Sep 10 11:30:03 2013 -0700 Merge branch 'master' into rmhbtm * master: Use Ruby 2.0 caller_locations instead of caller if available Update Rails 3.2.x guide link [ci skip] Be sure to restore the default I18n.locale after changed its value in a test Fixes typo in Object#try! More unused associations in AR test models :scissors: [ci skip] change function def self.table_name to self.table_name Clean up unused associations in AR test model Reset ActionView::Base.logger instead of AC::Base.logger Refactor handling of action normalization Don't mutate the Base settings by merge!ing the given value Make AC standalone rendering work use assert_empty in activemodel conditional validation test cases Removed unused modules and classes Removed unnecessary require Remove helper fixtures not used in any test Back AV description in gemspec Fix order dependent test grab executable from rubygems Fixed API task file commit 11b3d5fa45b57fc4e7dddb09be583498b120b185 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 16:19:48 2013 -0700 change query count since we are using hm:t associations commit f59daebedab3ed13f31c99244ff71a4a5d6e554b Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 15:35:07 2013 -0700 delegate compute_type to a real AR class commit c84a40d2ed76e5843b994c5a2b9e29ced3816511 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 15:29:51 2013 -0700 define callbacks with the builder commit d08b1b6b3efc9ed8b0d5476892f048fbffb39e40 Merge: acebec1 0c5d0be Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 15:17:40 2013 -0700 Merge branch 'master' into rmhbtm * master: let the class cache object clean up user input make @bitsweat happy. :heart: commit acebec128e108ac2b4855e540d8764629670cb83 Merge: 2de68a4 e1cbd42 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 14:47:30 2013 -0700 Merge branch 'master' into rmhbtm * master: stop using deprecated api in the tests commit 2de68a464641f76067743957f889ac87dff395a0 Merge: 7504df9 1385ae1 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 14:34:37 2013 -0700 Merge branch 'master' into rmhbtm * master: Remove BasicRendering tests Remove remaining coupling with AV in MimeResponds Remove BasicRendering and remove template functionality from AbsC::Rendering Improves a sentence in guides/security [ci skip] Change link name of Rails i18n wiki. Typo in Changelog. Fix fixtures regression that required table names to map to classes only, not class names Use MiniTest::Unit::TestCase instead of Minitest::Test Use Ruby on Rails Coding Conventions for code examples in the guides commit 7504df92f21ed3d5da7c2760d760f026728ed04d Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Mon Sep 9 14:34:02 2013 -0700 fake class name should be a valid class name commit 6609620ea86dc0fb7c4bbfb0db950f6e3fc75b56 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:52:03 2013 -0700 move another habtm commit 2c95a36e2c3dfe92f2930f3cca44bc4452732a23 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:50:18 2013 -0700 use the habtm name to generate the rhs name on the join model commit bd963f720b1db19b0bec186bc33bef9203d8b011 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:47:29 2013 -0700 don't hardcode the name commit 461759e2caf66f23dca4eff988648bf769a2b533 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:45:27 2013 -0700 we do not need to specify the fk commit 9c223f01db6e36adbb7570e2aa1bcaec1d142c87 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:44:08 2013 -0700 just call the left side :left_side commit 5661622a82154eff877fe0993bfffad13dacad7a Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Sep 6 15:40:36 2013 -0700 initial habtm implementation is working
* | Removed where_values_hash from AR::NullRelationPaul Nikitochkin2013-09-281-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to build associated records for owners which has not been saved need to get where values to use as default attributes. But for new record owner uses `ActiveRecord::NullRelation` which override `where_values_hash` to return empty hash stub. `where_values_hash` is not used to invoke any sql query, but good to build others chains (even will be never executed) like: ```ruby post = Post.new admin_comment = post.admin_comments.build assert_equal 'Admin', admin_comment.author ``` Closes #11376, #11676, #11675
* | adding a test to demonstrate how to use STI subclasses on the far rightAaron Patterson2013-09-271-0/+7
| | | | | | | | side of a hm:t association along with preloading.
* | fix .find when inverse is setArthur Neves2013-09-251-0/+12
| | | | | | | | .find([1]) should return an Array of entries, even when a invese object is in memory already
* | Merge pull request #12359 from arthurnn/inverse_on_callbacksRafael Mendonça França2013-09-251-0/+7
|\ \ | | | | | | Make sure inverse_of is visible on the has_many callbacks