因此,我尝试使用 pry 在我的 Rails 应用程序中调试 method_missing 并得到:
[5] pry(#<VoyageArrival>)> puts e
NameError: undefined local variable or method `e' for #<VoyageArrival:0x007fa3f30d13c8>
这是我的代码
21: define_method(save_method) do
22: if "@#{method_name}".present?
23: begin
24: self.send("#{attribute}=", Time.parse(instance_variable_get("@#{method_name}")))
25: rescue => e
=> 26: binding.pry