All posts filed under “spree

Accessing Spree routes from outside a controller

Some custom reports I was adding to Spree required links back to the products being listed. Accessing the Spree routes is slightly different to accessing normal Rails routes from outside a controller/view:

It’s my data

Recently I’ve been working on migrating an existing e-commerce site from InstanteStore to Spree and have been having a nightmare of a time trying to get the client’s data out so that I can start the job of importing it all. The trouble is a lot of the information is not exportable, and whatever data is available is only half of what you would expect. It’s starting to make me angry because as far as I’m concerned that data belongs to my client, and to add insult to injury, to get access to certain parts of the data they want to charge extra money to “build an interface” to it.

I can understand on free to use sites like Facebook/Instagram/Tumblr/Whatever-Startup that the price of usage might be my data and that I might not be able to take it and go elsewhere with it, but when you’re paying for a service I expect to have full ownership and access to my information.

Adding a custom Spree payment Gateway outside a Rails Engine

Adding a new Payment Gateway to Spree through a Rails Engine is pretty straight forward as you can hook in your new gateway after the initial payment gateway array has been created. This is how the spree_gateway gem does it:

If you want to do the same thing for your own project contained gateway it’s a little different. If you try to just directly edit the payment_methods array in an initializer it will get wiped out when the Spree core engine sets the initial bogus and simple methods. I got around the problem by hooking my gateway in using the after_initialize method. Here I’m hooking in after SpreeGateway: