rails - after_save 与 after_commit
访问量: 1594
https://ruby-china.org/topics/29503
after_save: 对于 update, create 都会用到。
但是如果 该block中的代码抛出异常, 那么 这个save 就会取消。
所以,如果希望block中的代码不会影响到 save等操作,就要用 after_commit
访问量: 1594
https://ruby-china.org/topics/29503
after_save: 对于 update, create 都会用到。
但是如果 该block中的代码抛出异常, 那么 这个save 就会取消。
所以,如果希望block中的代码不会影响到 save等操作,就要用 after_commit