# Rake load\_fixtures task doesn't load fixtures in plugins?

**URL:** <https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213>\
**Category:** Rails\
**Created:** [November 24, 2005, 4:04am UTC](https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213 "2005-11-24T04:04:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joevandyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@joevandyk](https://www.ruby-forum.com/u/joevandyk)\
**Post date:** [November 24, 2005, 4:04am UTC](https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213/1 "2005-11-24T04:04:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joevandyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@joevandyk](https://www.ruby-forum.com/u/joevandyk)\
**Post date:** [November 24, 2005, 4:12am UTC](https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213/2 "2005-11-24T04:12:14Z")

</div>

On 11/23/05, Joe Van D. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![joevandyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@joevandyk](https://www.ruby-forum.com/u/joevandyk)\
**Post date:** [November 24, 2005, 11:11am UTC](https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213/3 "2005-11-24T11:11:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joevandyk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@joevandyk](https://www.ruby-forum.com/u/joevandyk)\
**Post date:** [November 29, 2005, 4:29am UTC](https://www.ruby-forum.com/t/rake-load-fixtures-task-doesnt-load-fixtures-in-plugins/101213/4 "2005-11-29T04:29:36Z")

</div>

On 11/24/05, James A. [removed\_email\_address@domain.invalid](mailto: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.
