My question is related to ROR, but in fact it’s rather about ruby syntax I think.
In a model there is a built in method ‘save’, which saves the model to a database. I need to override the method, to do some additional job concerning files. I overloaded the method with a new one which takes 2 arguments. What I want to do now is to disable the original save method, so I don’t use it somewhere accidentally. For now I managed to do this by using alias_method. Now after calling save method with no arguments only prints a message to the console. The problem is this message probably will be overlooked.
What will be the best way to handle this?
Bye
Your best option is to use the
before_saveandafter_savecallbacks in Ruby on Rails.You can read more about them here: http://guides.rubyonrails.org/active_record_validations_callbacks.html#callbacks-overview