ruby on rails,undefined方法'属于'

时间:2013-04-18 19:06:43

标签: ruby-on-rails ruby activerecord

我是ror的新手,我收到了错误

class Item < ActiveRecord::Base
  attr_accessible :latitude, :longitude, :photos, :price, :title, :user_id, :category_id
  attr_accessor :user_id, :category_id
  belongs_to :user
  belongs_to :catgory
  reverse_geocoded_by :latitude, :longitude
  after_validation :reverse_geocode
end

调用堆栈是:

ActionController::RoutingError (undefined method `belings_to' for #<Class:0x00000003b1c418>):
app/models/item.rb:5:in `<class:Item>'
app/models/item.rb:1:in `<top (required)>'
app/controllers/item_controller.rb:1:in `<top (required)>'

1 个答案:

答案 0 :(得分:3)

ActionController::RoutingError (undefined method `belings_to'

应为belongs_to,请检查您的代码