I have this in my form:
<%= f.select :status, options_for_select(Article::STATUS), :include_blank => true, :selected => @article.status, :class => 'select_field' %>
Model:
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
Why does not populate the field?
I believe you can simply pass an array in
[#select][1]. You don’t need to call options for collection. I also think you can ommit the:selectedoption if this is a model form, Rails will figure it out using the attribute value.Try this: