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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:34:16+00:00 2026-05-14T04:34:16+00:00

First time I’ve come to use collection_select in a project and I’ve hit a

  • 0

First time I’ve come to use collection_select in a project and I’ve hit a wall with it.

A Profile has_one Team, Team has_many Profile.

In my view for editing profiles I have this.

<td><%= f.collection_select(:team_id, @team, :id, :title) %></td>

Which populates the drop down with titles of teams as expected. The couple of examples I have read seem to use it in a very similar way.

I can’t figure out when the profile is saved why it isn’t populating the team_id field in my DB. In the development log the team_id is being passed.

Processing ProfilesController#update (for 127.0.0.1 at 2010-03-28 22:49:16) [PUT] Parameters: {"commit"=>"Update", "profile"=>{"dob(1i)"=>"2010", "second_name"=>"", "dob(2i)"=>"3", "role"=>"", "dob(3i)"=>"28", "project"=>"", "specialties"=>"", "about"=>"", "team_id"=>"1", "status"=>"", "first_name"=>""}, "authenticity_token"=>"sdTiFPGj9JCO3OEge5EGNGxZbQSsq9ME5LP342EBjyc=", "id"=>"3"}

The update controller is the standard scaffold one, this has worked fine for all other additions to the profile model I’d made previously. Am I missing something obvious?

EDIT: Full log/development.log for update action

Processing UsersController#edit (for 127.0.0.1 at 2010-03-30 20:41:52) [GET] Parameters: {"id"=>"3"}
  User Load (5.3ms)   SELECT * FROM "users" WHERE ("users"."id" = 3) LIMIT 1
  Profile Load (2.0ms)   SELECT * FROM "profiles" WHERE (user_id = 3) LIMIT 1
  Team Load (6.9ms)   SELECT * FROM "teams" 
Rendering template within layouts/main
Rendering users/edit
Completed in 143ms (View: 53, DB: 14) | 200 OK [http://localhost/users/3/edit]


Processing ProfilesController#update (for 127.0.0.1 at 2010-03-30 20:42:00) [PUT] Parameters: {"commit"=>"Update", "profile"=>{"dob(1i)"=>"2010", "second_name"=>"", "dob(2i)"=>"3", "role"=>"", "dob(3i)"=>"28", "project"=>"", "specialties"=>"", "about"=>"", "team_id"=>"1", "status"=>"", "first_name"=>""}, "authenticity_token"=>"m6klUObst8uSATwkei5nY6ISx4OCHHCr9lDRYD5+mrc=", "id"=>"3"}
  User Load (2.0ms)   SELECT * FROM "users" WHERE ("users"."id" = 3) LIMIT 1
  Profile Load (2.2ms)   SELECT * FROM "profiles" WHERE ("profiles"."id" = 3) 
  Profile Update (39.6ms)   UPDATE "profiles" SET "updated_at" = '2010-03-30 19:42:00', "team_id" = 1 WHERE "id" = 3
[paperclip] Saving attachments.
Redirected to http://localhost:3000/users/3
Completed in 359ms (DB: 44) | 302 Found [http://localhost/profiles/3]


Processing UsersController#show (for 127.0.0.1 at 2010-03-30 20:42:00) [GET] Parameters: {"id"=>"3"}
  User Load (1.5ms)   SELECT * FROM "users" WHERE ("users"."id" = 3) LIMIT 1
  Profile Load (2.2ms)   SELECT * FROM "profiles" WHERE (user_id = '3') LIMIT 1
Rendering template within layouts/main
Rendering users/show
  Team Load (1.0ms)   SELECT * FROM "teams" WHERE ("teams"."id" = 1) 
Completed in 115ms (View: 66, DB: 5) | 200 OK [http://localhost/users/3]
  • 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-14T04:34:16+00:00Added an answer on May 14, 2026 at 4:34 am

    try this:

    <%= f.collection_select(:profile, :team_id, @team, :id, :title) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time posting here after having so many of my Google results come up
First time working with the HTMLParser module. Trying to use standard string formatting on
First time it worked great. But after modifying to use resource files I don't
first time SO user :) I know that I can format a number like
The first time I load the website in the production web server, it start
The first time I try to open a particular form many of the controls
This is my first time attempting to call an ASP.NET page method from jQuery.
This is my first time using joomla. I don't know if I'm using the
Long time listener, first time caller. I'm a full time SE during the day
This is my first time with Web services. I have to develop web services

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.