Sometimes I hit some questions with code samples in the question or some of the answers that are deprecated.
Example: The before destroy callback
In this question from 2009 about some feature of Ruby on Rails we find several details in the code samples which are deprecated in the latest versions of Rails.
For example:
def before_destroy
should now be
before_destroy :do_something
def do_something
...
end
or this one:
errors.add_to_base("A project with effort logged cannot be deleted")
should now be
errors.add(:base, "A project with effort logged cannot be deleted")
I'm sure other questions and technologies have similar problems. Is there a recommended way what to do about this? While an experienced developer won't have too much of a problem here, for some people it may be quite confusing if he tries to run some of this code and gets strange error messages or deprecation warnings from Rails.