ruby on rails - How to solve "undefined method belogns_to" for db association? -


i set association in db , got trouble...

one category own many beacons

class category < activerecord::base     has_many :beacons end 

one beacon belongs 1 category, , beacons table has column named cid associate category's id

class beacon < activerecord::base     belogns_to :category, foreign_key: "cid" end 

but when try post json request, server tells me:

nomethoderror (undefined method `belogns_to' #<class:0x007fb15cf053b0>):   app/models/beacon.rb:2:in `<class:beacon>'   app/models/beacon.rb:1:in `<top (required)>' 

did missed somthing add? or have add gem belogns_to , has_many method? or wrong in table setting? use rails 4.2.2

thanks!

typo, should spelled "belongs_to" :)


Comments