# Rails 2.3.2 bug? Detecting changed fields

**URL:** <https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379>\
**Category:** Rails\
**Created:** [March 31, 2009, 5:34pm UTC](https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379 "2009-03-31T17:34:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Meech](https://www.ruby-forum.com/u/Meech)\
**Post date:** [March 31, 2009, 5:34pm UTC](https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379/1 "2009-03-31T17:34:26Z")

</div>

I have a text field in the database, lets call it log. If I do  
something like this:

x = MyModel.find(1)  
x.log \<\< “append some text”  
x.save

Nothing is saved.

If I do something like this:

x = MyModel.find(1)  
x.log += “append some text”  
x.save

It works. Seems like a bug.

---

<div class="post-metadata">

**Author:** ![Meech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Meech](https://www.ruby-forum.com/u/Meech)\
**Post date:** [March 31, 2009, 5:37pm UTC](https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379/2 "2009-03-31T17:37:22Z")

</div>

On Mar 31, 4:33 pm, Meech [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Nothing is saved.
> 
> If I do something like this:
> 
> x = MyModel.find(1)  
> x.log += “append some text”  
> x.save
> 
> It works. Seems like a bug.

See [http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.html](http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.html) - if you  
change things inplace you need to use the foo\_will\_change! methods

---

<div class="post-metadata">

**Author:** ![Meech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Meech](https://www.ruby-forum.com/u/Meech)\
**Post date:** [March 31, 2009, 5:44pm UTC](https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379/3 "2009-03-31T17:44:23Z")

</div>

Ah, I see.

Too much work, doesn’t feel like it’s my job to tell what’s changed  
or will change.

I’ll just switch to +=

---

<div class="post-metadata">

**Author:** ![Meech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Meech](https://www.ruby-forum.com/u/Meech)\
**Post date:** [March 31, 2009, 5:44pm UTC](https://www.ruby-forum.com/t/rails-2-3-2-bug-detecting-changed-fields/164379/4 "2009-03-31T17:44:58Z")

</div>

On further testing…

x = MyModel.find(1)  
x.log \<\< “append some text”

> > x.changed  
> > =\> []

> > x.log  
> > =\> “old valueappend some text”

The value is clearly changed in the resident copy of the model, yet it  
doesn’t recognize it as changed.
