ruby on rails - ActiveRecord: Disable certain methods like 'save' or make them private -
in rails, use lot of models have customized methods create_new!
replace built in methods (normally wrap additional functionality without having use filters, i'm trying avoid).
because of this, i'd disable (or more elegantly, make private) methods create
or save
. there possibility of making methods private without nasty side-effects?
you can use alias_method function rename method obfuscate, , redefine method throw error or exception. example,
alias_method :save_private, :save def save(*) activesupport::deprecation.warn("method deprecated , disabled, please use save_new") false end
Comments
Post a Comment