Saturday, June 5, 2010

[Rails] failure in model#new - I don't get it

Here's my error:

NameError (undefined local variable or method `gmap_full_address' for
#<Class:0x7f9bae66e788>):
app/models/address.rb:12

here's the model:

class Address < ActiveRecord::Base

attr_accessible :name, :address1, :address2, :city, :state_id, :country_id, :postal_code,
:carrier_id, :time_zone, :gmap_lat, :gmap_long

...

after_save {
logger.info "attempting geocode retrieval for
#{gmap_full_address}" <------------------
result = get_geocode(gmap_full_address)
gmap_lat = result[:latitude]
gmap_long = result[:longitude]
save
}

def gmap_full_address
address1 + ", " + city + ", " + state.abbrev
end

I don't understand why it's saying gmap_full_address is indefined.

Anyone know why?

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate