aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
Commit message (Collapse)AuthorAgeFilesLines
* Fix polymorphic eager load with foreign_key as String.Lauro Caetano2014-05-201-0/+13
| | | | | | | | | 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.
* Prevented belongs_to: touch propagating up if there are no changes being savedBrock Trappitt2014-05-211-0/+7
|
* Remove dead test code for unsupported adaptersSean Griffin2014-05-171-17/+3
|
* Fix how to compute class name on habtm namespaced.Kassio Borges2014-05-131-0/+12
| | | | | | Thank's for @laurocaetano for the help with tests. :smiley: Fixes #14709
* deprecate, join, preload, eager load of instance dependent associations.Yves Senn2014-05-101-4/+27
| | | | | | | Closes #15024. These operations happen before instances are created. The current behavior is misleading and can result in broken behavior.
* test, regression test for has_many with instance dependent scope.Yves Senn2014-05-091-0/+10
|
* set a constant for the "anonymous" habtm model fixes #15022Aaron Patterson2014-05-081-0/+6
| | | | | I wanted the middle model to be anonymous, but we have to give it a name for marshal support. :'(
* Fixed HABTM's CollectionAssociation sizeFred Wu2014-05-081-0/+18
| | | | | HABTM should fall back to using the normal CollectionAssociation's size calculation if the collection is not cached or loaded. This addresses both #14913 and #14914 for master.
* Remove duplicated fixture additionCarlos Antonio da Silva2014-05-031-1/+1
|
* Refactor test to not care about the specific result of valid?Carlos Antonio da Silva2014-05-031-3/+4
| | | | | | Only care about its truthiness rather than asserting specific true/false values. If we need to check for the return value in particular, there will be a test for that.
* Merge pull request #14924 from eric-chahin/issue_13854Matthew Draper2014-05-031-0/+10
|\ | | | | | | Fixed custom validation context bug for child associations
| * Fixed custom validation context bug where childEric Chahin2014-05-011-0/+10
| | | | | | | | | | | | | | | | associations were not being saved. Fixes #13854. [Eric Chahin, Aaron Nelson, & Kevin Casey]
* | push up bind params on "simple" subquery calculationsAaron Patterson2014-05-021-1/+7
| | | | | | | | | | bind parameters we not being propogated to simple subquery calculation calls. This fixes it
* | Remove unused variableRafael Mendonça França2014-05-011-1/+1
|/
* add test to check that loaded and non laoded are the sameeileencodes2014-04-281-0/+13
| | | | | | | Test checks that SQL is the same for a loaded vs not loaded association (category.categorizations, category.categorization.delete_all vs category.cartegroization.delete_al). This was fixed for delete_all dependency but was not fixed for no (:nullify, or nil) dependency).
* clear shouldnt fire callbacks so remove order testeileencodes2014-04-281-3/+0
| | | | | | Since clear shouldn't fire callbacks the order doesn't matter since it was never updated. Remove the portion of this test that tests for order after clear.
* rewrite test to correctly test clear methodeileencodes2014-04-281-2/+2
| | | | | | | Clear should not call callbacks because it clear calls delete_all and then returns self. It should behave the same as delete_all. This test clarifies the goal of the test and tests the correct outcome.
* Merge pull request #14853 from kassio/kb-fix-custom-join-table-habtmYves Senn2014-04-251-0/+5
|\ | | | | Fix to use custom join table in habtm
| * Fix custom join_table name on habtm reflectionsKassio Borges2014-04-251-0/+5
| | | | | | | | | | | | When used a custom join_table name on a habtm, rails was not saving it on Reflections. This causes a problem when rails loads fixtures, because it uses the reflections to set database with fixtures.
* | Merge branch 'master' into adequaterecordAaron Patterson2014-04-251-4/+16
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 ...
| * Perfer to define methods instead of calling testRafael Mendonça França2014-04-221-4/+4
| | | | | | | | This file is using this pattern already
| * Fix syntax errorRafael Mendonça França2014-04-221-0/+1
| |
| * Merge pull request #14573 from habermann24/has_many_through_fixRafael Mendonça França2014-04-221-0/+11
| |\ | | | | | | | | | | | | | | | | | | | | | Properly handle scoping with has_many :through. Fixes #14537. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/has_many_through_associations_test.rb
| | * Properly handle scoping with has_many :through. Fixes #14537.Jan Habermann2014-04-031-0/+12
| | |
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-143-4/+45
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (70 commits) [ci skip] Added link to ruby-lang.org installation. Use the index on hidden field `collection_check_boxes` respects `:index` option for the hidden filed name. docs, double meaning of `serialize` argument. Closes #14284. Just call read_attribute, no need to use `send`. - Fix lingering reference to `:text` instead of the newer `:plain` - Section references `form_tag` instead of the `form_for` used in the example again, read_attribute is public, so just call it read_attribute is public, so we should just call it Disable assest cache store in docs [ci skip] Make counter cache decrementation on destroy idempotent Write the failing test case for concurrent counter cache [ci skip] Use plain underscore instead of "\_". Update documentation to use Rails.application instead Add a changelog entry for #14546 [ci skip] Move tests for deep_dup and duplicable to object directory Missing 'are' in note - [ci skip] CollectionHelpers now accepts a readonly option Fix a few typos [ci skip] Bundle tzinfo-data on :x64_mingw (64-bit Ruby on Windows). don't bother with an offset if the offset is zero ...
| * | Merge pull request #14735 from byroot/idempotent-counter-cachesAaron Patterson2014-04-141-0/+21
| |\ \ | | | | | | | | Idempotent counter caches, fix concurrency issues with counter caches
| | * | Write the failing test case for concurrent counter cacheJean Boussier2014-04-131-0/+21
| | | |
| * | | Just call read_attribute, no need to use `send`.Lauro Caetano2014-04-141-3/+3
| |/ / | | | | | | | | | Follow up to af549a1ad6692d7e2c756750651f0e1b293f5185
| * | :scissors:Rafael Mendonça França2014-04-111-2/+2
| | |
| * | Merge pull request #14711 from ↵Rafael Mendonça França2014-04-111-0/+8
| |\ \ | | | | | | | | | | | | | | | | | | | | swoker/activerecord_fix_aggregate_methods_with_select Activerecord fix aggregate methods with select
| | * | fix exception on polymorphic associations with predicatesSimon Woker2014-04-111-0/+8
| | | |
| * | | Merge pull request #12829 from iantropov/issue_insert_via_hmt_scope_3548Rafael Mendonça França2014-04-101-1/+13
| |\ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | Fix insertion of records for hmt association with scope Conflicts: activerecord/CHANGELOG.md
| | * | Fix insertion of records for hmt association with scope, fix #3548Ivan Antropov2013-11-171-1/+13
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-074-5/+68
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (122 commits) Rails.application should be set inside before_configuration hook remove check for present? from delete_all Remove useless begin..end Build the reverse_order on its proper method. Use connection-specific bytea escaping Ignore order when doing count. make enums distinct per class Remove unused `subclass_controller_with_flash_type_bar` var from flash test. fix CollectionProxy delete_all documentation Added OS X specific commands to installation guide [ci skip] Recommended using homebrew for installing MySQL and PostgreSQL Fix setup of adding _flash_types test. Use SVG version of travis build status badge [skip ci] W3C CSP document moved to gihub.io URL [ci skip] sprockets-rails was released Fix the test defining the models in the right place Add CHANGELOG entry for #11650 [ci skip] Declare the assets dependency Use sass-rails 4.0.3 Make possible to use sprockets-rails 2.1 add missing parentheses to validates_with documentation [skip ci] ...
| * | | Fix the test defining the models in the right placeRafael Mendonça França2014-04-041-15/+5
| | | |
| * | | Merge pull request #11650 from prathamesh-sonpatki/renameRafael Mendonça França2014-04-041-0/+18
| |\ \ \ | | | | | | | | | | | | | | | Renamed private methods _create_record and _update_record
| | * | | [Active Record] Renamed private methods create_record and update_recordPrathamesh Sonpatki2014-02-201-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645
| * | | | Remove unused variableRafael Mendonça França2014-04-041-1/+1
| | | | |
| * | | | Fix error when using `with_options` with lambda.Lauro Caetano2014-04-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was causing error when using `with_options` passing a lambda as its last argument. class User < ActiveRecord::Base with_options dependent: :destroy do |assoc| assoc.has_many :profiles, -> { where(active: true) } end end It was happening because the `option_merger` was taking the last argument and checking if it was a Hash. This breaks the HasMany usage, because its last argument can be a Hash or a Proc. As the behavior described in this test: https://github.com/rails/rails/blob/master/activesupport/test/option_merger_test.rb#L69 the method will only accept the lambda, this way it will keep the expected behavior. See 9eaa0a34
| * | | | Merge pull request #14546 from ↵Aaron Patterson2014-03-311-1/+16
| |\ \ \ \ | | |_|_|/ | |/| | | | | | | | | | | | | eileencodes/fix_delete_all_to_not_use_IN_statement Fix delete all to not produce sql in statement
| | * | | add test to compare sql statements in delete_all queryeileencodes2014-03-311-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | delete_all sql if an association is not loaded should behave the same as if the association is loaded. This test ensures the SQL statements are exactly the same.
| * | | | Simplify Preloader#grouped_records code.thedarkone2014-03-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new method relies on AR::Associations::Association knowing about both reflection and a model class. AR::Base#association now raises a descriptive error when trying to access non-existent associations. Previously it would blow up with a confusing NoMethodError: undefined method `association_class' for nil:NilClass.
| * | | | Fix polymorphic preloads on NOT NULL _type columns.thedarkone2014-03-301-0/+11
| |/ / / | | | | | | | | | | | | Defer to Association#klass instead of having a custom/duplicate code.
| * | | Merge pull request #14154 from al2o3cr/issue12770Aaron Patterson2014-03-271-0/+9
| |\ \ \ | | | | | | | | | | Pass a base relation to build_default_scope when joining
| | * | | Pass a base relation to build_default_scope when joiningMatt Jones2014-02-211-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | This allows the default scope to be built using the current table alias. Resolves #12770
| * | | | Use rails convetionsRafael Mendonça França2014-03-251-2/+2
| | | | |
| * | | | Merge pull request #14390 from huoxito/true-touchRafael Mendonça França2014-03-251-0/+11
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Still touch associations when theres no timestamp
| | * | | | Still touch associations when theres no timestampWashington Luiz2014-03-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to Rails 4.0.4 when touching a object which doesn't have timestamp attributes (updated_at / updated_on) rails would still touch all associations. After 73ba2c14cd7d7dfb2d132b18c47ade995401736f it updates associations but rollsback because `touch` would return nil since there's no timestamp attribute
* | | | | | Merge branch 'master' into adequaterecordAaron Patterson2014-03-255-3/+48
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (96 commits) clarify CHANGELOG [ci skip]. Fix Generation of proper migration when ActiveRecord::Base.pluralize_table_names = false. update comments to reflect that options support is not available synchronize changelogs and 4.1 release notes. [ci skip] do not rely on method_missing hitting arel use ARel factory methods for building AST nodes Fix date_select option overwriting html classes - Rename `increment_or_decrement` to an apt `set_cache_value` since it actually doesn't increment/decrement in localstore. Check if any sqlite files are not included in the gitignore Remove sqlite3 lines from .gitignore if the application is not using sqlite3. Adding active_model in Rails::Info Clean up tables after each test. Swapped parameters of assert_equal in assert_select Update test helper to use latest Digestor API Digestor should just rely on the finder to know about the format and the variant -- trying to pass it back in makes a mess of things (oh, and doesnt work) Log the full path, including variant, that the digestor is trying to find Fix for digestor to consider variants for partials -- this still needs more testing!! fix log_tags request object grammar Extract with_example_table into helper method. test for structure:dump without schema information table. refs eafec46 ... Conflicts: activerecord/test/cases/relation/where_chain_test.rb
| * | | | | Add counter cache test for class_nameArthur Neves2014-03-171-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Backport test from #14410