Ruby/RoR: calling original method via super()?

后端 未结 3 1266

In a RoR app, I want to specialize ActiveRecord\'s update_attributes() method in one of my models, extracting some of the attributes for special handling and passing the res

3条回答
  •  半阙折子戏
    2020-12-30 05:45

    You want:

    super(attrs)
    

    That will call the original method, passing attrs as an argument to it.

    As it is now, you're trying to call update_attributes on the "true" value returned by the original update_attributes.

提交回复
热议问题