Why the record is updated?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs