Implicit argument passing of super from method defined by define_method() is not supported

前端 未结 2 542
一个人的身影
一个人的身影 2021-02-07 12:38

In \"Agile Web Development with Rails\" (third edition) page 537 - 541 it has \"Custom Form Builders\" code as follows:

  class TaggedBuilder < Actio         


        
2条回答
  •  攒了一身酷
    2021-02-07 13:01

    I encountered with this problem in a define_method without arguments

    define_method :"#{info_type}_info" do
    
      info = super
      .......
    
    end
    

    And still found this problem. I had to explicit put the parenthesis:

    define_method :"#{info_type}_info" do
    
      info = super()
      .......
    
    end
    

提交回复
热议问题