after_save回调与虚拟属性Rails 3

时间:2011-09-08 08:44:13

标签: ruby-on-rails-3 after-save

我不知道这是否可行所以我想我会问。

1. Give a model some virtual attributes
2. Assign values to the model and the virtual attributes
3. Save the model 
4. Use a callback after_save to create a different object with the virtual attributes.

可以在Rails 3中完成吗?

1 个答案:

答案 0 :(得分:1)

只要关联与您无关,请使用:

http://apidock.com/rails/ActiveRecord/Base/clone