rails/activerecord/test/models
Sean Griffin 10f75af933 Use bind values for joined tables in where statements
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]
2014-11-01 15:39:51 -06:00
..
admin Remove warnings in test suite 2014-01-06 16:40:32 +01:00
autoloadable Fix ActiveRecord subclass_from_attrs when eager_load is false. 2013-03-06 11:46:07 +04:00
publisher Fix has_and_belongs_to_many in a namespaced model pointing to a non namespaced model 2014-06-19 14:59:48 -03:00
admin.rb Support fixtures for namespaced models [#2965 state:resolved] 2010-04-25 16:04:38 +02:00
aircraft.rb Refactoring test_has_many_with_pluralize_table_names_false test 2011-05-20 01:53:13 -05:00
arunit2_model.rb added test for #3732 2012-02-10 17:35:22 -05:00
author.rb Use bind values for joined tables in where statements 2014-11-01 15:39:51 -06:00
auto_id.rb ✂️ [ci skip] 2013-09-10 19:49:42 +02:00
binary.rb move assets and models 2008-01-18 07:27:03 +00:00
bird.rb Allow nested attributes in associations to update values in it's owner object. Fixes a regression from 3.0.x 2011-12-14 20:13:03 -06:00
book.rb Add more tests for the dirty feature for enums 2014-01-21 12:45:58 -02:00
boolean.rb Add missing model 2010-08-14 18:49:04 -03:00
bulb.rb Raise RecordNotDestroyed when children can't be replaced 2013-11-25 19:30:07 -02:00
cake_designer.rb scope_chain should not be mutated for other reflections 2013-10-14 11:59:59 -04:00
car.rb Make AR::Base#touch fire the after_commit and after_rollback callbacks 2014-01-16 09:05:59 -02:00
categorization.rb Deprecate eager-evaluated scopes. 2012-03-21 22:18:18 +00:00
category.rb Pass a base relation to build_default_scope when joining 2014-02-21 17:58:40 -05:00
chef.rb scope_chain should not be mutated for other reflections 2013-10-14 11:59:59 -04:00
citation.rb More unused associations in AR test models 2013-09-10 19:50:00 +02:00
club.rb Merge pull request #15772 from nbudin/sti_through_bug 2014-06-19 15:07:11 -03:00
college.rb Fix error when using with_options with lambda. 2014-04-03 10:26:37 -03:00
column_name.rb Changing the def self.table_name to self.table_name in the column_name.rb 2013-08-03 23:59:28 +05:30
column.rb Fix the test defining the models in the right place 2014-04-04 19:44:17 -03:00
comment.rb Skip StatementCache for eager loaded associations (Fixes #16761) 2014-09-04 10:05:01 -05:00
company_in_module.rb Add support for module-level table_suffix in models 2014-05-05 12:41:26 -07:00
company.rb Move association definition to the model file 2014-08-28 15:50:14 +09:00
computer.rb move assets and models 2008-01-18 07:27:03 +00:00
contact.rb Move writing unknown column exception to null attribute 2014-06-26 09:43:35 -06:00
contract.rb adding a test to demonstrate how to use STI subclasses on the far right 2013-09-27 16:56:49 -07:00
country.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
course.rb added test for #3732 2012-02-10 17:35:22 -05:00
customer.rb Revert "Removing composed_of from ActiveRecord." 2012-07-27 19:25:14 -03:00
dashboard.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
default.rb move assets and models 2008-01-18 07:27:03 +00:00
department.rb scope_chain should not be mutated for other reflections 2013-10-14 11:59:59 -04:00
developer.rb Only merge scopes with zero arity in has_many through 2014-08-20 08:25:58 +03:00
dog_lover.rb Update other counter caches on destroy 2013-03-20 13:43:07 -07:00
dog.rb Update other counter caches on destroy 2013-03-20 13:43:07 -07:00
drink_designer.rb scope_chain should not be mutated for other reflections 2013-10-14 11:59:59 -04:00
edge.rb move assets and models 2008-01-18 07:27:03 +00:00
electron.rb Add test case for autosave HasMany with accepts_nested_attributes. 2014-02-08 18:57:26 -02:00
engine.rb expanding the test to include both type of order declaration 2010-09-18 20:49:19 +02:00
entrant.rb move assets and models 2008-01-18 07:27:03 +00:00
essay.rb Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many 2010-10-19 14:14:06 +01:00
event.rb Ensure validates_uniqueness_of considers limit on the field. [#1042 state:resolved] 2009-03-07 13:52:17 +00:00
eye.rb use persisted? instead of new_record? wherever possible 2010-11-09 13:54:04 -02:00
face.rb Address ORA-00972: identifier is too long when tested with Oracle 2014-07-14 21:54:17 +09:00
friendship.rb Refactor Person/Friendship relationships to be more intuitive 2013-03-17 02:11:19 -04:00
guid.rb Fix validates_uniqueness_of for SQL keywords [#23 state:resolved] 2008-05-11 19:30:03 +01:00
hotel.rb scope_chain should not be mutated for other reflections 2013-10-14 11:59:59 -04:00
interest.rb Getting rid of the +automatic_inverse_of: false+ option in associations in favor 2013-06-08 10:16:51 -07:00
invoice.rb Add failing test that triggers the stack overflow 2010-01-08 21:45:02 +01:00
item.rb move assets and models 2008-01-18 07:27:03 +00:00
job.rb Fix naughty trailing whitespace 2010-10-31 11:21:28 +00:00
joke.rb Deprecate set_table_name in favour of self.table_name= or defining your own method. 2011-11-29 20:13:36 +00:00
keyboard.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
legacy_thing.rb Deprecate set_locking_column in favour of self.locking_column= 2011-11-29 20:13:37 +00:00
lesson.rb Fixing ordering of HABTM association deletion [#6191 state:resolved] 2011-02-04 19:39:59 -02:00
line_item.rb Add failing test that triggers the stack overflow 2010-01-08 21:45:02 +01:00
liquid.rb rename Relation#uniq to Relation#distinct. #uniq still works. 2013-03-15 14:15:47 +01:00
man.rb Address ORA-00972: identifier is too long when tested with Oracle 2014-07-14 21:54:17 +09:00
matey.rb move assets and models 2008-01-18 07:27:03 +00:00
member_detail.rb Getting rid of the +automatic_inverse_of: false+ option in associations in favor 2013-06-08 10:16:51 -07:00
member_type.rb Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved] 2008-12-18 19:19:36 +00:00
member.rb Raise an error for has_one associations which try to go :through a polymorphic association [#17263] 2014-10-15 20:25:09 +07:00
membership.rb adding a test for sti on middle tables with sorting on RHS 2013-09-23 18:13:08 -07:00
minimalistic.rb move assets and models 2008-01-18 07:27:03 +00:00
minivan.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
mixed_case_monkey.rb docs, AR already auto-detects primary keys. Closes #13946. [ci skip] 2014-02-05 08:52:59 +01:00
molecule.rb Add test case for autosave HasMany with accepts_nested_attributes. 2014-02-08 18:57:26 -02:00
movie.rb AR .persisted? throws SystemStackError for an unsaved model with a 2014-03-27 15:01:31 -03:00
order.rb move assets and models 2008-01-18 07:27:03 +00:00
organization.rb Deprecate eager-evaluated scopes. 2012-03-21 22:18:18 +00:00
owner.rb Fix regression on eager loading association based on SQL query rather 2014-06-03 16:20:08 -03:00
parrot.rb Better regression test for Fixtures with fk as a symbol 2014-09-22 13:12:19 -04:00
person.rb Dynamically modified schema and association would not be correctly reset 2014-09-06 23:28:18 +09:00
personal_legacy_thing.rb Dynamically modified schema and association would not be correctly reset 2014-09-06 23:28:18 +09:00
pet.rb Add missing require to inheritance test 2013-04-03 14:48:57 -03:00
pirate.rb Fixed custom validation context bug where child 2014-05-01 03:27:24 -04:00
possession.rb Fix pluck when columns/tables are reserved words. 2012-09-05 18:00:07 -04:00
post.rb Use bind values for joined tables in where statements 2014-11-01 15:39:51 -06:00
price_estimate.rb Fix nested association references 2012-09-12 23:32:50 +01:00
project.rb More unused associations in AR test models 2013-09-10 19:50:00 +02:00
publisher.rb Fix how to compute class name on habtm namespaced. 2014-05-13 11:26:46 -03:00
randomly_named_c1.rb Test fixtures with custom model and table names 2011-12-30 10:34:01 +01:00
rating.rb Revert "Merge pull request #14544 from jefflai2/named_scope_sti" 2014-05-21 12:15:57 -03:00
reader.rb Merge pull request #14573 from habermann24/has_many_through_fix 2014-04-22 17:20:52 -05:00
record.rb Fix the test defining the models in the right place 2014-04-04 19:44:17 -03:00
reference.rb Rename update_attributes method to update, keep update_attributes as an alias 2013-01-03 11:51:21 -05:00
reply.rb Add test to AR's counter_cache_test.rb 2013-05-18 17:12:46 +09:00
ship_part.rb Nested records (re: autosave) are now updated even when the intermediate parent record is unchanged [#4242 state:resolved] 2010-05-18 16:13:00 +02:00
ship.rb Fixed custom validation context bug where child 2014-05-01 03:27:24 -04:00
shop.rb Don't try to get the subclass if the inheritance column doesn't exist 2014-01-14 18:53:45 +05:30
speedometer.rb test case to prevent duplicated associations with custom PK. 2013-02-24 16:49:47 +01:00
sponsor.rb Convert association macros to the new syntax 2012-07-20 14:14:51 +01:00
string_key_object.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
student.rb Fix error when using with_options with lambda. 2014-04-03 10:26:37 -03:00
subject.rb use persisted? instead of new_record? wherever possible 2010-11-09 13:54:04 -02:00
subscriber.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
subscription.rb Fix reset_counters() crashing on has_many :through associations. 2012-10-02 23:49:32 +08:00
tag.rb The source option for has_many => through should accept String 2014-04-09 14:57:30 -03:00
tagging.rb Deprecate automatic counter caches on has_many :through 2014-06-26 07:24:34 -06:00
task.rb Revert "Unused methods, module, etc." 2013-01-24 21:44:02 +09:00
topic.rb changed update counter to act on unscoped model 2013-11-26 09:04:03 -06:00
toy.rb Deprecate eager-evaluated scopes. 2012-03-21 22:18:18 +00:00
traffic_light.rb test case for serialize default values. 2013-03-07 17:26:35 +01:00
treasure.rb Obey validate: false option for habtm 2014-03-14 20:30:55 -03:00
treaty.rb Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
tyre.rb Ensure we can nest include calls [#5285 state:resolved] 2010-08-12 13:10:58 -03:00
uuid_child.rb Auto-generate stable fixture UUIDs on PostgreSQL. 2014-01-07 19:05:50 +01:00
uuid_parent.rb Auto-generate stable fixture UUIDs on PostgreSQL. 2014-01-07 19:05:50 +01:00
vegetables.rb rewrite inheritance tests with a custom inheritance_column 2012-09-03 20:30:43 +02:00
vertex.rb move assets and models 2008-01-18 07:27:03 +00:00
warehouse_thing.rb Deprecate set_table_name in favour of self.table_name= or defining your own method. 2011-11-29 20:13:36 +00:00
wheel.rb reset_counter should work with non-traditional belongs_to and polymorphic belongs_to 2010-07-08 23:24:12 +02:00
without_table.rb Deprecate eager-evaluated scopes. 2012-03-21 22:18:18 +00:00
zine.rb Providing support for :inverse_of as an option to associations. 2009-05-04 15:27:39 -07:00