Skip to content

Loading…

Environment is not loaded when using Mongoid and accessing sub-seed #16

Merged
merged 1 commit into from

2 participants

@ahmadsherif

Say we have this task db:seed:admins and we're using Mongoid (>= 3.0.0), we run and it throws an error like uninitialized constant <ModelName> and aborts. Running db:seed runs fine though.

This seems related to issue #5.

@james2m james2m merged commit 349a9ac into james2m:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/seedbank/dsl.rb
View
2 lib/seedbank/dsl.rb
@@ -13,7 +13,7 @@ def override_seed_task(*args, &block)
def seed_task_from_file(seed_file)
scopes = scope_from_seed_file(seed_file)
fq_name = scopes.push(File.basename(seed_file, '.seeds.rb')).join(':')
- args = Rake::Task.task_defined?('db:abort_if_pending_migrations') ? { fq_name => 'db:abort_if_pending_migrations' } : fq_name
+ args = Rake::Task.task_defined?('db:abort_if_pending_migrations') ? { fq_name => 'db:abort_if_pending_migrations' } : { fq_name => :environment }
define_seed_task(seed_file, args)
end
Something went wrong with that request. Please try again.