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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.