My rails version is 4.2.2. понедельник, 29 июня 2015 г., 20:00:27 UTC+3 пользователь Frederick Cheung написал: > > > > On Monday, June 29, 2015, Мурыгин Антон <[email protected] <javascript:>> > wrote: >> >> Now this is my model >> class Business < ActiveRecord::Base >> belongs_to :category, class_name: 'BusinessCategory', foreign_key: >> 'business_category_id' >> >> def category >> super || BusinessCategory.new(name: 'other') >> end >> end >> >> Why it keeps throwing >> >> super: no superclass method `category' for #<Business:0x000001023014b8> >> >> ? Am i missing something? >> > > Which version of rails? > > Fred > >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/fabf3f0c-db07-44b4-a04c-0b060eb9eaa5%40googlegroups.com >> >> <https://groups.google.com/d/msgid/rubyonrails-talk/fabf3f0c-db07-44b4-a04c-0b060eb9eaa5%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4335c57a-d26d-48f8-84ca-c98ca897b4be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

