Hello, I have two models. blog_post belongs_to :blog_category blog_category has_many :blog_post Whenever I do this, I get error (uninitialized constant BlogPost::BlogCategories) <%= post.blog_categories.name %> Post is variable which continue one row from the blog_post table. BUT when I write this, it works, but this is bad to have it in the view :( <%= BlogCategory.find_by_id(post.blog_category_id).name %> Anyone knows why I'm getting: uninitialized constant BlogPost::BlogCategories? and thanks many times :)
on 2007-05-06 01:47
on 2007-05-06 14:11
Jamal Soueidan wrote: > Hello, > > I have two models. > > blog_post > belongs_to :blog_category > > blog_category > has_many :blog_post > Weird ?