Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninitialized constant ActionView::CompiledTemplates::Category

using this tutorial

http://railscasts.com/episodes/57-create-model-through-text-field

need to make it work in my app, was on rails 3.0.7 and it worked fine, updated it to 3.1.3 and I got this error now

uninitialized constant ActionView::CompiledTemplates::Category

I would look for answers more time but now I am really short on time. I have looked into most part of google results related to this problem and no good. Need help please.

form

<%= f.collection_select :category_id, Category.find(:all), :id, :name, :prompt => "Select a Category" %>
or create one:
<%= f.text_field :new_category_name %>

model

class Tvstation < ActiveRecord::Base
  belongs_to :category
  attr_accessor :new_category_name
  before_save :create_category_from_name

  def create_category_from_name
    create_category(:name => new_category_name) unless new_category_name.blank?
  end
end
like image 544
rmagnum2002 Avatar asked May 14 '12 18:05

rmagnum2002


1 Answers

ok, just for others if they will get into this stupid things as I did, don't forget to have the category.rb in the app/models..

class Category < ActiveRecord::Base
  ...
end
like image 138
rmagnum2002 Avatar answered Oct 18 '22 01:10

rmagnum2002