mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Support strings as attribute names
When generating the `_fast_attributes` method, attribute names that could not be represented as symbols (at least without escaping) would throw parsing errors.
This commit is contained in:
@@ -451,7 +451,7 @@ module ActiveModel
|
||||
method << " h = {}\n"
|
||||
|
||||
_attributes.each do |name,key|
|
||||
method << " h[:#{key}] = read_attribute_for_serialization(:#{name}) if send #{INCLUDE_METHODS[name].inspect}\n"
|
||||
method << " h[:\"#{key}\"] = read_attribute_for_serialization(:\"#{name}\") if send #{INCLUDE_METHODS[name].inspect}\n"
|
||||
end
|
||||
method << " h\nend"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user