Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

ActiveRecord update_attribute problem

#5232

Hey Guys,

I'm Using Rails 3.0RC. I found a strange behavior on #update_attribute method, not sure if this is bug, but this works in Rails 3.0.0beta4, but not in 3.0RC:

class Item < ActiveRecord::Base
  belongs_to :user
end

class User < ActiveRecord::Base
  has_many :items
end

ree-1.8.7-2010.02 > u = User.first
 => #<User id: 1, name: "Exception", created_at: "2010-07-22 07:52:03", updated_at: "2010-07-22 07:52:03"> 
ree-1.8.7-2010.02 > u.item_ids
 => [] 
ree-1.8.7-2010.02 > u.update_attributes(:item_ids => [1])
 => true 
ree-1.8.7-2010.02 > u.item_ids
 => [1] 
ree-1.8.7-2010.02 > u.update_attribute(:item_ids, [1])
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: item_ids: UPDATE "users" SET "item_ids" = NULL, "updated_at" = '2010-07-28 12:33:08.068794'  WHERE ("users"."id" = 1)

Reported by Thiago Pradi · July 28th, 2010 @ 05:44 PM

State: invalid
Milestone: none
Assigned to: Neeraj Singh Neeraj Singh
Importance: Low

Activity

  1. Neeraj Singh
    Neeraj Singh
    • State changed from new to invalid
    • Importance changed from to Low

    July 28th, 2010 @ 05:52 PM

  2. Thiago Pradi
    Thiago Pradi

    Hm, thanks for the explanation!

    July 28th, 2010 @ 06:09 PM