Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:46:07+00:00 2026-06-08T17:46:07+00:00

I have this in my form: <%= f.select :status, options_for_select(Article::STATUS), :include_blank => true, :selected

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:46:09+00:00Added an answer on June 8, 2026 at 5:46 pm

    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 :selected option if this is a model form, Rails will figure it out using the attribute value.

    Try this:

    <%= f.select :status, Article::STATUS, :include_blank => true, :class => 'select_field' %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have this form : <form action=Change-status.php method=post> <select class=changeStatus name=changeStatus> <option
I have this form:- <form action=> <table border=0> <td colspan=2 class=instruction>Select your desired option
I have a simple dropdown menu: <form class=feedmenu align=center> <select onchange=showRSS1(this.value)> <option value=>Select an
I have this select input in my form that I want to access via
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
Suppose I have a form like this: Name:<input type=text name=xxx id=name/> Type:<select> <option>xx</option> <option>xx</option>
I have a form in a .html files where input/select box looks like this
I have a form that looks like this. <form action=index.php method=post> <select name=dropdownOption> <option
I have this form: <%= form_tag posts_path, :method => :get, :class => search_nav do
I have the following models set up: class Player < ActiveRecord::Base has_many :game_players has_many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.