Which one is considered as best-practice and why ?
It depends on the situation, and there are several other ways. You
can override method_missing to not raise an error, you can use try,
you can use a null object (which certainly keeps the calling code
cleanest), and probably a few others that aren’t springing to my mind
immediately…
-Dave
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.