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 8435223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:51:27+00:00 2026-06-10T06:51:27+00:00

I simply want to set the undefined value for select. By undefined I mean

  • 0

I simply want to set the undefined value for select. By undefined I mean “undefined” one but not only default one.

I have this:

= form_for @address do |f|
  = f.select :country_id, [['no country selected','0']] + Country.as_key_value_array

where Country.as_key_value_array returns an array of [['country1','1'], ['country2','3'],['country3','3']]

Is there any other way to reach what I want?

  • 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-10T06:51:29+00:00Added an answer on June 10, 2026 at 6:51 am

    f.select :country_id, "<option value='0'>no country selected</option>".html_safe + options_from_collection_for_select(Country.all, :id, :name)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of strings, e.g. my_prefix_what_ever my_prefix_what_so_ever my_prefix_doesnt_matter I simply want to
What do I have to do to get this code work? I simply want
I simply want to get the current value of a field's attribute. This field
I have a simple program. I want to set the path and some properties
This is a simple requirement: I want to add a set of strings to
I have searched already but unable to find an answer that works. I simply
I know this is crazy, but IE can drive one to do crazy things.
I have 2 classes, ClassA and ClassB ClassA has one BOOL variable set to
I want to have cakephp paginate data and still use containable , but for
Maybe this question is kind of silly but I have no clue how to

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.