ITeye博客

method_missing

共 1 篇文章

关于method_missing 和respond_to?的基本用法

method_missing is a well-known tool in the Ruby metaprogramming toolbox. It’s callback method you can implement that gets called when a object tries to call a method that’s, well, missing. A well known example of this is ActiveRecord dynamic finders. For example, if your User has an email attribute…

2012-12-12 07:46 · ruby · respond_to? · method_missing