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.

This project is archived and is in readonly mode.

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

#5405

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

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

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Marjan Krekoten'
    Marjan Krekoten'

    Well, I tried this under rails master. I cann't reproduce bug...

    August 26th, 2010 @ 12:31 PM

  2. Oleg
    Oleg

    Seems this problem existed under RC. Current 3.0 has no problem.

    September 10th, 2010 @ 05:22 PM

  3. Oleg
    Oleg
    • Title changed from update_attribute attempts to write accessor to the database to [Invalid] - update_attribute attempts to write accessor to the database

    September 10th, 2010 @ 05:22 PM

  4. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to invalid
    • Importance changed from to Low

    September 11th, 2010 @ 04:31 AM