Class alias in Ruby

后端 未结 5 1363
温柔的废话
温柔的废话 2020-12-08 13:45

I am developing a new Rails app based on a similar existing one. In my old app, I have Coupon class, which is very similar to Ticket in my new app. I want to reuse all code

5条回答
  •  情话喂你
    2020-12-08 13:50

    I agree with warhog, more or less - but I would subclass ticket from your coupon class - that way if you need to do any data munging, you can put the code in your ticket class

提交回复
热议问题