Rake load_fixtures task doesn't load fixtures in plugins?


#1

I’ve got the login_engine plugin installed which has a fixtures for
‘users’.

When I load ‘rake load_fixtures’, it doesn’t seem to load the
login_engine’s fixtures into the development database.

Should it? Or should it be another rake task? (i.e. rake
load_plugin_fixtures)

Joe


#2

On 11/23/05, Joe Van D. removed_email_address@domain.invalid wrote:

I’ve got the login_engine plugin installed which has a fixtures for ‘users’.

When I load ‘rake load_fixtures’, it doesn’t seem to load the
login_engine’s fixtures into the development database.

Should it? Or should it be another rake task? (i.e. rake load_plugin_fixtures)

Joe

In any event, here’s the additional rake task that will load all
plugin fixtures:

desc “Load plugin fixtures into the current environment’s database”
task :load_plugin_fixtures => :environment do
require ‘active_record/fixtures’
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
Dir.glob(File.join(RAILS_ROOT, ‘vendor’, ‘plugins’, ‘’, ‘test’,
‘fixtures’, '
.yml’)).each do |fixture_file|
Fixtures.create_fixtures(File.dirname(fixture_file),
File.basename(fixture_file, ‘.*’))
end
end

Joe


#3

Since engines are a special-case plugin ‘type’, it’s unlikely that the
default rake tasks would support them. However, I can see it being a
bit of a grey area, since testing plugins is supported.

Regardless - I’ll add this task to the Engine plugin so it is
available to everyone using engines, thanks Joe

  • james

#4

On 11/24/05, James A. removed_email_address@domain.invalid wrote:

Since engines are a special-case plugin ‘type’, it’s unlikely that the
default rake tasks would support them. However, I can see it being a
bit of a grey area, since testing plugins is supported.

Regardless - I’ll add this task to the Engine plugin so it is
available to everyone using engines, thanks Joe

I think that task should work for all plugins that have fixtures,
engines or no.