On Oct 1, 10:48 pm, Pedro <pogerm...@gmail.com> wrote:
> Ok, now I got it, the code is below, but now I have the follow error:
>
> Attempt to call private method
>
> I dont know if it is related with this error, but this table is a
> legacy and I had to set table name and primary key.
>
update is a private method - you should be calling save (or save!)
Fred
> The model is :
> class Cartcid < ActiveRecord::Base
> set_table_name "cartcid"
> set_primary_key "NUMERO"
> end
>
> namespace :GeoFind do
> desc 'Update cartcid with longitude and latitude information'
> task :add_cartcid_coordinates => :environment do
> include GeoKit::Geocoders
> c = Cartcid.find_by_sql(["SELECT address, lat, lng FROM
> cartcid WHERE ADDRESS IS NOT NULL"])
> begin
> c.each { |cartcid|
> loc = MultiGeocoder.geocode(cartcid.address)
> cartcid.lat = loc.lat
> cartcid.lng = loc.lng
> cartcid.update
> puts "updated cartcid #{cartcid.nome}
> #{cartcid.address} =>
> [#{loc.lat}, #{loc.lng}]"
> }
> rescue
> puts $!
> end
> end
> end
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment