나는 내 양식이 있습니다레일즈를 사용하여 편집 페이지에서 선택 상자를 채우는 방법은 무엇입니까?
<%= f.select :status, options_for_select(Article::STATUS), :include_blank => true, :selected => @article.status, :class => 'select_field' %>
는 모델 :
class Article < ActiveRecord::Base
attr_accessible :author, :content, :publication_date, :status, :title, :tag_tokens
attr_reader :tag_tokens
STATUS = ['Rascunho', 'Em Revisão', 'Publicado']
end
왜 필드를 채울하지 않는 이유는 무엇입니까?
가 어떻게 초기화 할 * f를 *? 그것은 객체 형식입니까 아니면 형식일까요? – Achilles
F는 객체 형식 – Predoff