using this tutorial
http://railscasts.com/episodes/57-create-model-through-text-field
I need to make it work in my application, it was on rails 3.0.7, and it worked fine, updated it to 3.1.3, and now I got this error
uninitialized constant ActionView::CompiledTemplates::Category
I will look for answers more time, but now I have a very short time. I looked at most of the Google results related to this problem and nothing good. Need help please.
the 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
source share