Skip to content
Snippets Groups Projects
Commit 85a0b974 authored by Florian Frank's avatar Florian Frank Committed by Alex Reisner
Browse files

Use Ruby attribute setters and not write_attribute

This change will call the writer methods defined on an AR model, if they're
implemented, instead of going behind their back. This also avoids a rails 3
deprecation warning, if the named attributes aren't actually database
attributes.
parent 6719d9d2
No related branches found
No related tags found
No related merge requests found
......@@ -289,8 +289,8 @@ module Geocoder::Store
do_lookup(false) do |o,rs|
if r = rs.first
unless r.latitude.nil? or r.longitude.nil?
o.send :write_attribute, self.class.geocoder_options[:latitude], r.latitude
o.send :write_attribute, self.class.geocoder_options[:longitude], r.longitude
o.__send__ "#{self.class.geocoder_options[:latitude]}=", r.latitude
o.__send__ "#{self.class.geocoder_options[:longitude]}=", r.longitude
end
r.coordinates
end
......@@ -307,7 +307,7 @@ module Geocoder::Store
do_lookup(true) do |o,rs|
if r = rs.first
unless r.address.nil?
o.send :write_attribute, self.class.geocoder_options[:fetched_address], r.address
o.__send__ "#{self.class.geocoder_options[:fetched_address]}=", r.address
end
r.address
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment