diff options
author | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-22 20:06:45 -0300 |
---|---|---|
committer | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-22 20:06:45 -0300 |
commit | 47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8 (patch) | |
tree | 26d0a84a3cefd153b5315c37addb784e1b9228f3 /activerecord/lib/active_record/relation | |
parent | c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397 (diff) | |
parent | e853acb9b4cfb5bb91a241cf37084631cd145823 (diff) | |
download | rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.tar.gz rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.tar.bz2 rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.zip |
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index b12497fd0a..94c42fb630 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -923,21 +923,18 @@ module ActiveRecord @arel ||= build_arel(aliases) end - # Returns a relation value with a given name - def get_value(name) # :nodoc: - @values.fetch(name, DEFAULT_VALUES[name]) - end - - protected + private + # Returns a relation value with a given name + def get_value(name) + @values.fetch(name, DEFAULT_VALUES[name]) + end # Sets the relation value with the given name - def set_value(name, value) # :nodoc: + def set_value(name, value) assert_mutability! @values[name] = value end - private - def assert_mutability! raise ImmutableRelation if @loaded raise ImmutableRelation if defined?(@arel) && @arel @@ -1202,8 +1199,9 @@ module ActiveRecord STRUCTURAL_OR_METHODS = Relation::VALUE_METHODS - [:extending, :where, :having, :unscope, :references] def structurally_incompatible_values_for_or(other) + values = other.values STRUCTURAL_OR_METHODS.reject do |method| - get_value(method) == other.get_value(method) + get_value(method) == values.fetch(method, DEFAULT_VALUES[method]) end end |