This project is archived and is in readonly mode.

#5232 ✓invalid
Thiago Pradi

ActiveRecord update_attribute problem

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

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)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages