观察你自己的方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了观察你自己的方法相关的知识,希望对你有一定的参考价值。
Rails builds on the standard Ruby observer, so you can too.Originally found at http://rails.techno-weenie.net/forums/1/topics/672?page=6,
so don't give me any credit ;)
def my_method! #- Your Method Code Here -# self.class.changed self.class.notify_observers(:my_method, self) end That will call any observers 'my_method' method.
以上是关于观察你自己的方法的主要内容,如果未能解决你的问题,请参考以下文章