I’m sure this has to do with the complexity of Spree’s loading.
But my main problem is that Spree can not load a Country. For me it,s Country.find(214). If I check it in my remote console, I find it no worries. All the countries, all the states are there.
But if I try to set Country.find(214) in the controller for states_controller#index, or make a before_load method that does that, or put it in the view itself, it always returns :Error (Couldn't find Country with ID=214).
Crazy, right? I can’t think of what to do at this point. If I do Country = Country.first. I can sort of get it to work by just loading an empty template of index.haml. So that means that some sort of country exists that it is tapping into.
Anyone have any theoretical thoughts as to why this is happening? And how I might be able to circumvent it?
Sorry this is a little late, but I stumbled onto your post and figured out what was causing the problem.
Country 214 is USA, and for some reason Spree defaults to that country. Which means that if you don’t have USA loaded, you’ll hit into that problem.
To get around it, you’ll have to manually set up a default country in your initializer:
I hope you’ve solved this by now though. 🙂