summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-05 18:39:27 -0400
committerDavid Gay <david@davidgay.org>2021-05-05 18:39:27 -0400
commit82fa2b72be613713d42b451e0d1801904b4580e8 (patch)
tree350b45ed1be179d67ce9cdd776a72fcbce4609a5 /app/models/concerns
parenta32e05fea88fa4d9b9072f5a7e25189c99b16b9d (diff)
Symbolize whatnot keys
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/has_whatnot.rb9
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