Skip to content

What's the difference between unchanged and unset? #770

Answered by billy1624
saintazunya asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @saintazunya, welcome and thanks for the supports!

Generally speaking you don't need ActiveValue::unchanged( ... ). All you need is just set() and not_set().

For update, what you want is just update the changed / setted values. That's why the unchanged value is being ignored.

For insert, we want all setted values including those unchanged values to be inserted into db.

That's the behaviour for update & insert :)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saintazunya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants