Hi there,

I'm using Spree in a Rails 3.2 app of mine and I want to extend Spree's Product class to better suit my needs as for example to establish a relationship with another model in my app. What's the best way to do this? I could not find anything about it in the project documentation

And what if I want to add new attributes/fields to the Product resource?
I can't find it's migration either

5 Years
Discussion Span
Last Post by Taywin

Do you want to inherit or hack the existing model? Do you have the source from github? Or how are you using it in your application right now?

One way to extend this model is to create a new table & model file (by running migration). Then implement methods that link between 2 models. Another is to add more fields to the table (also by running migration), and then simply modify the product model file (this is similar to hacking or forking). If you do not want or care to update Spree at all, the latter approach is better & easier to maintain; otherwise, you may need to do the formal approach.

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.