Allow symbols in YAML columns
Without this change, we were getting errors when manually creating an
annotation using symbols in the ranges hash (that is, `ranges: [{ start:
"/p[1] }]` instead of `ranges: [{ "start" => "/p[1] }]`.
Using symbols isn't really supported and it might cause strange issues
with code like: `@draft_version.annotations.find_by(range_start: ...)`.
However, this might be an extreme case and using symbols might work
properly most of the time (if not all the time), and we've been using
them in our demo for years.
So I'm not writing a test for this case because I'm not sure we should
support it, but I'm still allowing symbols so we don't get exceptions in
cases where everything might be working fine. Rails already adds Symbol
by default to column permitted classes [1], so it's safe to enable it.
[1] https://github.com/rails/rails/pull/45584/commits/c2b96e3e8
This commit is contained in:
@@ -22,7 +22,7 @@ module Consul
|
||||
config.active_support.use_authenticated_message_encryption = false
|
||||
|
||||
# Keep reading existing data in the legislation_annotations ranges column
|
||||
config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess]
|
||||
config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
|
||||
|
||||
# Handle custom exceptions
|
||||
config.action_dispatch.rescue_responses["FeatureFlags::FeatureDisabled"] = :forbidden
|
||||
|
||||
Reference in New Issue
Block a user