aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb2
-rw-r--r--activerecord/lib/active_record/enum.rb7
2 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 9506960be3..295dccf34e 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -114,7 +114,7 @@ module ActiveRecord
walk join_root, oj.join_root
else
oj.join_root.children.flat_map { |child|
- make_outer_joins join_root, child
+ make_outer_joins oj.join_root, child
}
end
}
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb
index 2f8439892b..1d484f7c15 100644
--- a/activerecord/lib/active_record/enum.rb
+++ b/activerecord/lib/active_record/enum.rb
@@ -18,6 +18,11 @@ module ActiveRecord
# # conversation.update! status: 1
# conversation.status = "archived"
#
+ # # conversation.update! status: nil
+ # conversation.status = nil
+ # conversation.status.nil? # => true
+ # conversation.status # => nil
+ #
# You can set the default value from the database declaration, like:
#
# create_table :conversations do |t|
@@ -62,7 +67,7 @@ module ActiveRecord
_enum_methods_module.module_eval do
# def status=(value) self[:status] = STATUS[value] end
define_method("#{name}=") { |value|
- unless enum_values.has_key?(value)
+ unless enum_values.has_key?(value) || value.blank?
raise ArgumentError, "'#{value}' is not a valid #{name}"
end
self[name] = enum_values[value]