lib/str_enum/model.rb in str_enum-0.4.0 vs lib/str_enum/model.rb in str_enum-0.4.1
- old
+ new
@@ -36,10 +36,10 @@
end
end
end
default_value = default == true ? values.first : default
after_initialize do
- send("#{column}=", default_value) unless try(column)
+ send("#{column}=", default_value) if has_attribute?(column) && !try(column)
end
define_singleton_method column.to_s.pluralize do
values
end
end