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

  • SEARCH
  • Home
  • 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 1021055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:15:11+00:00 2026-05-16T11:15:11+00:00

I am having a strange issue with a collection_select I am using in an

  • 0

I am having a strange issue with a collection_select I am using in an edit profile view in my rails application. The database IS being updated with the correct value, however the default value is not being selected for the select box when the user goes to edit their profile. I can not get a :include_blank => true or a :prompt => true to work either.

Here is the code

Edit View:

<%= render :partial => 'player_form' %>

_player_form Partial:

<% form_for @user do |f| %>
    <p>
        <%= f.label :course_id %><br / >
        <%= f.collection_select(:course_id, Course.all, :id, :name, {:prompt => "No Home    Course"})  %>
    </p>
<% end %>

Generated HTML:

<p> 
    <label for="user_course_id">Course</label><br / > 
<select id="user_course_id" name="user[course_id]">
        <option value="1">Bedford Springs</option> 
        <option value="2">Down River</option> 
        <option value="3">King Valley </option> 
        <option value="4">Test</option></select> 
</p> 

Because I am using cancan for authorization I have an empty edit action in my controller since cancan automatically initializes

@user = User.find(params[:id])

I have tried adding that line to edit and it doesn’t affect anything. Also the very strange thing about this issue is that all of the other fields in the edit form partial are populated with correct current values from the database. In addition, the Users table does have the course_id column which is the foreign key for the Courses table and I have checked the association in the console and it does return the correct course_id. The associations are setup properly because I have Therefore, I believe I have a problem with the syntax of my collection_select but I am not sure what it is.

I appreciate any help.

Thanks.

  • 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-05-16T11:15:12+00:00Added an answer on May 16, 2026 at 11:15 am

    I had course_id set as a varchar instead of an int in the database for one reason or another. Changing it too an int fixed the problem.

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

Sidebar

Related Questions

I am currently having a strange issue with an application migrated from rails 2.3.8
I am having a strange issue with jScrollPane plugin. After several days of using
I'm having a very strange issue with Python's subprocess.Popen. I'm using it to call
I'm having an excessively strange issue. I'm working on a project and it's being
I'm having a strange issue with abstract Calendar class using the GregorianCalendar method. For
I am having a strange issue when using the erase() function on a std:vector.
I'm having a strange issue when using subprocess.Popen.communicate(). For background, I want to execute
I'm having a strange issue with a site I'm designing. I'm using the WooCommerce
I'm having a strange issue with VS2010's database project not able to execute a
I'm having a strange issue with my modal view. The modal view asks for

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.