इस ट्यूटोरियलअप्रारंभीकृत निरंतर ActionView :: CompiledTemplates :: श्रेणी
http://railscasts.com/episodes/57-create-model-through-text-field
यह मेरे एप्लिकेशन में काम करने के लिए की जरूरत का उपयोग कर, रेल 3.0.7 पर था और यह 3.1.3 के लिए ठीक काम किया है, यह अद्यतन और मुझे यह त्रुटि अब मिली है
uninitialized constant ActionView::CompiledTemplates::Category
मैं अधिक समय के उत्तर की तलाश करूंगा लेकिन अब मैं वास्तव में समय पर छोटा हूं। मैंने इस समस्या से संबंधित Google परिणामों के अधिकांश भाग में देखा है और कोई अच्छा नहीं है। कृपया मदद की ज़रूरत है।
रूप
<%= 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