Created
September 13, 2014 06:42
-
-
Save ttanimichi/59f436486d3b36222dc9 to your computer and use it in GitHub Desktop.
Railsでcreateやsaveなどをオーバーライドする場合のサンプル。基本的にはbefore_saveなどで代替することが望ましいと思う。また、alias_methodを使って代替することもできる。ref. http://d.hatena.ne.jp/itmammoth/20121129/1354189157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.create(*args, &block) | |
# do something | |
super(*args, &block) | |
end |
Author
ttanimichi
commented
Sep 13, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment