I have a model:
class Item < ActiveRecord::Base
Item has a property 'store'
Based on the value of store, I'd like the Item object to have different behaviour for specific methods.
Is there a common design pattern for this in Rails? How is this done cleanly without a big if-else statement in the methods?
Usually through Single-Table Inheritance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With