sử dụng hướng dẫn nàyuninitialized liên tục ActionView :: CompiledTemplates :: Thể loại
http://railscasts.com/episodes/57-create-model-through-text-field
cần phải làm cho nó hoạt trong ứng dụng của tôi, đang trên đường ray 3.0.7 và nó làm việc tốt, cập nhật nó để 3.1.3 và tôi gặp lỗi này ngay bây giờ
uninitialized constant ActionView::CompiledTemplates::Category
Tôi sẽ tìm câu trả lời thêm thời gian nhưng bây giờ tôi thực sự thiếu thời gian. Tôi đã xem xét hầu hết các kết quả của google liên quan đến vấn đề này và không tốt. Cần giúp đỡ xin vui lòng.
dạng
<%= f.collection_select :category_id, Category.find(:all), :id, :name, :prompt => "Select a Category" %>
or create one:
<%= f.text_field :new_category_name %>
mô hình
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