Using engines/datetime toolbocks with another plugin

Hello,

I'm having trouble using datetime toolbocks (which in turn relies on engines) with another plugin. I'm using Goldberg (http://goldberg. 240gl.org/) as a CMS for my rails app. I have some models with date fields, and I'd like to use datetime toolbocks in the views that edit those fields. With the first version of Goldberg that I installed ( 0.1.6) this worked fine, because at the time Goldberg wasn't a plugin--it just put all of its MVCs into the usual directories under the app folder. Both Goldberg and Datetime toolbocks worked in the same app. Now there is a new Goldberg release ( 0.2.0) and the author has made Goldberg into a plugin. I've upgraded in order to get the latest bug fixes, but now I can't get Datetime toolbocks to work.

Specifically, after I install it, my page never loads. My browser just keeps saying "waiting for localhost...".

If I uninstall datetime toolbocks and engines, my site works fine (except for the views that use the calendar control). If I have datetime toolbocks and engines installed, but uninstall Goldberg, the site loads fine and I can use the calendar control. So the problem seems to be the interaction of these two.

Does anyone have any ideas how to fix or work around this?

Thanks, Myron

I would try loading the goldberg plugin before the engines and datetime_toolbocks plugin.

You can do so by modifying the environment.rb file and have the...

config.plugins = ["goldberg", "engines", "*"]

That may solve the conflict. If it doesn't, clear your log files, and paste what you see in the development log into an email here and that will help us debug it much more effectively.

Nathaniel.

Thanks for the quick response, Nathaniel.

I followed your suggestion. Doing so causes an exception to be thrown when mongrel starts up (even before I access the app with my browser). Here's the stack trace:

F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/loaded_plugins-0.1.0/lib/ loaded_plugins/plugin.rb:18:in `basename': can't convert nil into String (TypeError)         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/plugin.rb:18:in `name_for'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/loaded_plugins.rb:74:in `find_plugin_path'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/ lib/initializer.rb:401:in `inject'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/loaded_plugins.rb:73:in `each'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/loaded_plugins.rb:73:in `inject'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/loaded_plugins.rb:73:in `find_plugin_path'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ loaded_plugins-0.1.0/lib/loaded_plugins/loaded_plugins.rb:26:in `load_plugin'         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/ lib/initializer.rb:192:in `load_plugins'          ... 32 levels...         from F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/ lib/commands/server.rb:39         from F:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'         from F:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `require'         from script/server:3

My log file only gets one line:

  e[4;36;1mSQL (0.078000)e[0m e[0;1mSET SQL_AUTO_IS_NULL=0e[0m

Any other ideas?

Thanks!

- Myron

I guessed the goldberg plugin name. Is that correct?

Also, looking at the error, I see you are using loaded_plugins-0.1.0... which is basically another form of Engines.

Having both these won't work.

What are all the plugins you have installed?

Nathaniel.

Yes, that's the correct plugin name for Goldberg (at least, that's the name of the directory for the plugin...so that makes it the name, right? I'm very new to rails, so I'm still learning this stuff....)

First off, loaded_plugins is in my ruby\lib\ruby\gems\1.8\gems directory. I was under the impression that all plugins got loaded under my rails project folder project, under vendor\plugins. Is that incorrect? The ones I have in my app's vendor\plugins folder (and that I was aware of installing) are Goldberg, Datetime_toolbocks and Engines (and I only have engines because the datetime_toolbocks plugin requires it).

I looked at the loaded_plugins source and did some searching in my project, and it looks like loaded_plugins is required by another plugin called plugin_migrations (and this one is also in my ruby\lib \ruby\gems\1.8\gems directory). Goldberg in turn uses plugin_migrations. I don't think they were used by the original version of Goldberg installed, but when I upgraded to 0.2.0 and installed it via gems, it must have installed all dependencies, including loaded_plugins and plugin_migrations.

Any ideas? Are goldberg and datetime_toolbocks simply incompatible because one uses loaded_plugins and the other engines?

Thanks again! - Myron

The loaded plugins is a pluginaweek release.

http://wiki.pluginaweek.org/Loaded_plugins

If loaded_plugins is in fact required by the golbgerb plugin (which it appears it does), that would render the datetime toolbocks plugin incompabile as both engines and loaded plugins modify the Rails plugin handlers quite a bit.

I have read about some plugins being both pluginaweek and engines compatible. Might be worth investigating. You may very well be able to rip through the goldberg plugin and remove the inclusion of the loaded_plugins and the other ones, it may very well work.

Nathaniel.

Hi Guys,

If loaded_plugins is in fact required by the golbgerb plugin (which it appears it does), that would render the datetime toolbocks plugin incompabile as both engines and loaded plugins modify the Rails plugin handlers quite a bit.

I have read about some plugins being both pluginaweek and engines compatible. Might be worth investigating. You may very well be able to rip through thegoldbergplugin and remove the inclusion of the loaded_plugins and the other ones, it may very well work.

loaded_plugins and plugin_migrations are only used during Goldberg's database setup. They get loaded from RAILS_ROOT/vendor/plugins/ goldberg/init.rb:

# Load Plugin Migrations (if available) begin   require 'plugin_migrations' rescue MissingSourceFile   nil end

After you've done your `rake goldberg:install` you could comment out those lines. They're not necessary for Goldberg at runtime.

If that's the problem, I can fix it: I can move those lines into tasks/ goldberg_tasks.rake, so they never get invoked except when you're setting up the database. Would you be able to let me know please?

Regards, Dave

Hey Dave,

That _should_ fix it.

Nathaniel.

Gentlemen -

Thank you both. Commenting out the "require 'plugin_migrations' ", as Dave suggested, worked great. It sure is nice to be able to use both plugins!

- Myron

Hi Myron,

Thank you both. Commenting out the "require 'plugin_migrations' ", as Dave suggested, worked great. It sure is nice to be able to use both plugins!

Excellent news! Thanks for letting us know.

Goldberg 0.2.0 was a major release, so I expected some bugs would come up. (Fortunately no really serious problems.) This issue is one of them. I'm considering releasing 0.2.1 sooner than planned to clean up these issues, so keep your eyes open.

Regards, Dave