lib/voltron/encryptable.rb in voltron-encrypt-0.2.0 vs lib/voltron/encryptable.rb in voltron-encrypt-0.2.1
- old
+ new
@@ -62,12 +62,11 @@
end
end
module InstanceMethods
def assign_attributes(new_attributes)
- new_attributes.stringify_keys!
- belongs = self.class.reflect_on_all_associations(:belongs_to).map { |b| { column: "#{b.name}_id", class_name: (b.options[:class_name] || b.name).to_s.classify } }
+ belongs = self.class.reflect_on_all_associations(:belongs_to).map { |b| { column: "#{b.name}_id".to_sym, class_name: (b.options[:class_name] || b.name).to_s.classify } }
belongs.each do |belong|
begin
klass = belong[:class_name].safe_constantize
value = new_attributes[belong[:column]]
@@ -80,11 +79,10 @@
super(new_attributes)
end
def update_attributes(attributes)
- attributes.stringify_keys!
- belongs = self.class.reflect_on_all_associations(:belongs_to).map { |b| { column: "#{b.name}_id", class_name: (b.options[:class_name] || b.name).to_s.classify } }
+ belongs = self.class.reflect_on_all_associations(:belongs_to).map { |b| { column: "#{b.name}_id".to_sym, class_name: (b.options[:class_name] || b.name).to_s.classify } }
belongs.each do |belong|
begin
klass = belong[:class_name].safe_constantize
value = attributes[belong[:column]]