2
我在我的模型中得到了未定义的方法,但我相信我拥有它。方法未在模型中定义?
class Business < ActiveRecord::Base
attr_accessible :user_id, :name, :city, :state, :zip, :street, :latitude, :longitude
def new_address
[street, city, state, zip].join(', ')
end
geocoded_by :new_address
after_validation :geocode, :if => :new_address_changed?
end
我收到了未定义的方法错误new_address_changed?
这是错误的吗?
噢噢噢,会是什么替代如果'new_address'改变了? – hellomello
那么,你将不得不自己定义'address_changed?'方法,并检查其中的单个字段更改。 – pungoyal