This project is archived and is in readonly mode.

#5405 ✓invalid
Oleg

[Invalid] - update_attribute attempts to write accessor to the database

Reported by Oleg | August 18th, 2010 @ 05:47 PM

Let's say we have a class like this:

class Foo
  def bar=(value)
    # do something
  end

  def bar
    # return something
  end
end

Everything works great if I update attribute like this:

@foo.bar = 'something'
@foo.save

However, this:

@foo.update_attribute(:bar, 'something')

Blows up with:

ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'bar' in 'field list' ....

I can't for the life of me figure out why update_attribute tries to write that accessor to the database. Especially considering that internally it just assigns and saves. This is on 3.0.0.rc

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>

People watching this ticket

Pages