diff options
author | David Gay <david@davidgay.org> | 2021-05-05 18:39:27 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-05 18:39:27 -0400 |
commit | 82fa2b72be613713d42b451e0d1801904b4580e8 (patch) | |
tree | 350b45ed1be179d67ce9cdd776a72fcbce4609a5 /app/models/concerns | |
parent | a32e05fea88fa4d9b9072f5a7e25189c99b16b9d (diff) |
Symbolize whatnot keys
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/has_whatnot.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/concerns/has_whatnot.rb b/app/models/concerns/has_whatnot.rb new file mode 100644 index 0000000..a4dcfa0 --- /dev/null +++ b/app/models/concerns/has_whatnot.rb @@ -0,0 +1,9 @@ +module HasWhatnot + extend ActiveSupport::Concern + + included do + def whatnot + @whatnot ||= super.is_a?(Hash) ? super.deep_symbolize_keys! : nil + end + end +end |