File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
lib/active_model_serializers Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,11 @@ def updated_at
4242 defined? ( @updated_at ) ? @updated_at : File . mtime ( __FILE__ )
4343 end
4444
45+ # @return [Hash] immutable representation of declared attributes
4546 def attributes
4647 attribute_names . each_with_object ( { } ) do |attribute_name , result |
47- result [ attribute_name ] = public_send ( attribute_name )
48- end . with_indifferent_access
48+ result [ attribute_name . freeze ] = public_send ( attribute_name ) . freeze
49+ end . with_indifferent_access . freeze
4950 end
5051
5152 # The following methods are needed to be minimally implemented for ActiveModel::Errors
Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ def test_fragment_fetch_with_virtual_attributes
532532 role_hash = role_serializer . fetch_attributes_fragment ( adapter_instance )
533533 assert_equal ( role_hash , expected_result )
534534
535- role . attributes [ :id ] = 'this has been updated'
535+ role . id = 'this has been updated'
536536 role . name = 'this was cached'
537537
538538 role_hash = role_serializer . fetch_attributes_fragment ( adapter_instance )
You can’t perform that action at this time.
0 commit comments