This project is archived and is in readonly mode.
[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
-
Marjan Krekoten' August 26th, 2010 @ 12:31 PM
Well, I tried this under rails master. I cann't reproduce bug...
-
Oleg September 10th, 2010 @ 05:22 PM
Seems this problem existed under RC. Current 3.0 has no problem.
-
Oleg September 10th, 2010 @ 05:22 PM
- Title changed from update_attribute attempts to write accessor to the database to [Invalid] - update_attribute attempts to write accessor to the database
-
Rohit Arondekar September 11th, 2010 @ 04:31 AM
- State changed from new to invalid
- Importance changed from to Low
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>