diff options
author | Scott Ringwelski <sgringwe@mtu.edu> | 2016-02-01 20:17:17 -0800 |
---|---|---|
committer | Scott Ringwelski <sgringwe@mtu.edu> | 2016-02-02 15:05:16 -0800 |
commit | 08a748118377f22823e06315f57db16e1ce3a7c3 (patch) | |
tree | 3d8142294799177b9b7a0be86d1fda7ca9eb960b /activerecord/lib/active_record/core.rb | |
parent | 49e0c4e8642a0160bd01c4490b4babe89108da48 (diff) | |
download | rails-08a748118377f22823e06315f57db16e1ce3a7c3.tar.gz rails-08a748118377f22823e06315f57db16e1ce3a7c3.tar.bz2 rails-08a748118377f22823e06315f57db16e1ce3a7c3.zip |
Add initial support for allowing an error on order or limit of queries being ignored in batches
add some documentation and add 4 tests regarding error vs. warning behavior
fix a typo when referring to the message
go back to default in tests so that ordering is not important. use a constant instead of method. fix assert_nothing_raised call. use self.klass to allow per class configuration
remove logger warn assets as that is tested elsewhere. pass error_on_ignore through find_each and find_in_batches also.
add blocks to the finds so that the code is actually executed
put the setting back to default in an ensure
Add a changelog entry
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 475a298467..bed0cf9eea 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -72,6 +72,14 @@ module ActiveRecord ## # :singleton-method: + # Specifies if an error should be raised on query limit or order being + # ignored when doing batch queries. Useful in applications where the + # limit or scope being ignored is error-worthy, rather than a warning. + mattr_accessor :error_on_ignored_order_or_limit, instance_writer: false + self.error_on_ignored_order_or_limit = false + + ## + # :singleton-method: # Specify whether or not to use timestamps for migration versions mattr_accessor :timestamped_migrations, instance_writer: false self.timestamped_migrations = true |