This project is archived and is in readonly mode.

#5405 ✓invalid

[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

  def bar
    # return something

Everything works great if I update attribute like this: = 'something'

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=""></a>

People watching this ticket