# Why the record is updated?

**URL:** <https://www.ruby-forum.com/t/why-the-record-is-updated/87514>\
**Category:** Rails\
**Created:** [March 3, 2007, 8:03am UTC](https://www.ruby-forum.com/t/why-the-record-is-updated/87514 "2007-03-03T08:03:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![threeeyedfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a587f6/32.png) [@threeeyedfish](https://www.ruby-forum.com/u/threeeyedfish)\
**Post date:** [March 3, 2007, 8:03am UTC](https://www.ruby-forum.com/t/why-the-record-is-updated/87514/1 "2007-03-03T08:03:18Z")

</div>

Hi, all!  
I have the following problem:  
Suppose I have a post that has and belongs to many tags.  
If I do e.g.

my\_post.title = “New title”

I still need to do

my\_post.save

to write changes to the database  
But if I do

my\_post.tags = [some\_tag, some\_other\_tag]

the changes seem to be written down right there.  
Isn’t it a bug?  
This kind of behaviour is undesired for me because I wish to check  
before\_update which tags were added and removed to perform some  
manipulations with them. And if I do

my\_post.update\_attributes(:tags =\> new\_list\_of\_tags)

in before\_update changes are actually already been saved so I can’t get  
the old tags at all.

Any help will be appreciated.

Yours sincerely,  
Damian/Three-eyed Fish
