Home>

Always I am indebted.

Before_save is called when the Xxxxxx model is changed as shown below, but at that time, the controller receives the result is_change value and wants to change the process according to the result. We are here.

#Controller
def update
   Xxxxxx.update (aaa: aaa, yyy: yyy)
   I want to use the value of # is_change here
end
# model
class Xxxxxx


I tried google, but I couldn't find it well and asked this question.

It doesn't matter if it is a reference site, so I would appreciate it if you could teach me the appropriate method.
Thank you.

environment
Amazon Linux release 2 (Karoo)
Rails 5.2.3
Ruby version: 2.6.1

  • Answer # 1

    Time has passed, so I will close it once.

  • Answer # 2

    Why not make a conditional branch after checking if the records are the same?