Forum: Ruby on Rails rake load_fixtures task doesn't load fixtures in plugins?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-11-24 04:04
(Received via mailing list)
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
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-11-24 04:12
(Received via mailing list)
On 11/23/05, Joe Van Dyk <joevandyk@gmail.com> 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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 james.adam (Guest)
on 2005-11-24 11:11
(Received via mailing list)
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
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-11-29 04:29
(Received via mailing list)
On 11/24/05, James Adam <james.adam@gmail.com> 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.
This topic is locked and can not be replied to.