Skip to content
This repository
Browse code

Docfix: Use public interface instead of setting instance variables

Dynamically setting instance variables based on user input probably isn't a great idea. Better to go through the setter methods provided by attr_accessor.
  • Loading branch information...
commit 9906eb135575ea6dd154257b8c977321c4b1adb2 1 parent a68c6cc
Richard Livsey authored June 07, 2013
2  activemodel/lib/active_model/serializers/json.rb
@@ -109,7 +109,7 @@ def as_json(options = nil)
109 109
       #
110 110
       #     def attributes=(hash)
111 111
       #       hash.each do |key, value|
112  
-      #         instance_variable_set("@#{key}", value)
  112
+      #         send("#{key}=", value)
113 113
       #       end
114 114
       #     end
115 115
       #

0 notes on commit 9906eb1

Please sign in to comment.
Something went wrong with that request. Please try again.