Reputation: 10137
I have one polymorphic model which has attachment. For example:
Image : Polymorphic model Product and Customer are two different model which uses Image as polymorphic
Image model has attachment called :file which has :path and :url. I don't want to share :url and :path for Product and customer.
I need different url and path for Product and Customer model (i.e) I want to differentiate url and path based on object type.
Please help me.
Upvotes: 0
Views: 125
Reputation: 2099
If you need different Images on Product and Customer, why do you use a polymorphic relationship (I assume?) in the first place? If a ProductImage and a CustomerImage have nothing to do with each other (as you need to differentiate url and path?!) then why not simply make them two entirely independent Models? (Or, maybe, if that fits, inheriting from some shared base)
Upvotes: 1