Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

load seed not working #10

Closed
raulperezalejo opened this issue Apr 1, 2015 · 3 comments
Closed

load seed not working #10

raulperezalejo opened this issue Apr 1, 2015 · 3 comments

Comments

@raulperezalejo
Copy link

branch 3-0-stable
file lib/tasks/db.rake:16

the seed does not load.
The problem is not with this gem is with Spree because in 'spree_core' the task "db:load_dir" is used 'require' insted of 'load'.
'require' only load the file ones for each server start, so for a multitenant app this is a problem because seeds are only loaded in the first tenant.

So i was wondering if this issue can be solve in this gem.

regards

@JDutil
Copy link
Member

JDutil commented Apr 3, 2015

This is essentially the same issue as with setting preferences in an initializer, which I've just added a brief bit to the readme for:
https://github.com/spree-contrib/spree_shared#setting-store-preferences

You need to switch the Apartment database for each tenant you want to run the task for.

@JDutil JDutil closed this as completed Apr 3, 2015
@raulperezalejo
Copy link
Author

thank you for your awnser but this solution does not work for me, in my console, manually i do:

$rails c

Apartment::Tenant.switch 'aa'
Spree::Core::Engine.load_seed if defined?(Spree::Core) # seeds are loaded ok
Apartment::Tenant.switch 'bb'
Spree::Core::Engine.load_seed if defined?(Spree::Core) # seeds are no loaded

when i restart the server the task can be executed ones more and so on.

so i don't think that solution could work. in my Spree local copy i have changed 'require' by 'load' and everythink works fine, i can switch and load seed, no matter how many times.
maybe for the configuration of each tenent it work but not for the db:seed task.

@JDutil
Copy link
Member

JDutil commented Apr 6, 2015

Perhaps send a PR to spree core then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants