使用本教程初始化常数::的ActionView :: CompiledTemplates类别
http://railscasts.com/episodes/57-create-model-through-text-field
需要让它在我的应用程序的工作,是在轨道3.0.7和它工作得很好,其更新为3.1.3我现在得到这个错误
uninitialized constant ActionView::CompiledTemplates::Category
我会寻找答案更多的时间,但现在我真的很短的时间。我已经调查了与这个问题有关的谷歌结果的大部分,并没有好处。需要帮助。
形式
<%= f.collection_select :category_id, Category.find(:all), :id, :name, :prompt => "Select a Category" %>
or create one:
<%= f.text_field :new_category_name %>
模式
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