[edit]  Hung figured it out:  it was because script/generate scaffold used the wrong param:

if @user_interest.update_attributes(params[:user_interests])

and it’s all gravy again

Using partials, i have

<%= collection_select( :user_interests, :user_id, User.find(:all), :id, :name ) %>

And it generates a nice drop-down menu:

pulldown

But here’s what the backend code rails spits out:

Parameters: {"commit"=>"Update", "authenticity_token"=>"b2c2fdab6a0c70d2ec41806384fde56e1b1c72c4", "_method"=>"put", "action"=>"update", "id"=>"1", "controller"=>"user_interests", "user_interests"=>{"privacy_level_id"=>"1", "interest_id"=>"3", "user_id"=>"1"}}
UserInterest Load (0.000368) SELECT * FROM user_interests WHERE (user_interests."id" = 1)
UserInterest Update (0.000478) UPDATE user_interests SET "created_at" = '2008-03-09 19:34:20', "privacy_level_id" = NULL, "interest_id" = NULL, "updated_at" = '2008-03-09 19:46:33', "user_id" = NULL WHERE "id" = 1
Redirected to http://localhost:3000/user_interests/1
Completed in 0.01664 (60 reqs/sec) | DB: 0.00085 (5%) | 302 Found [http://localhost/user_interests/1]

What’s going on?

Advertisements