[Backgroundrb-devel] Unable to load Models which reference plugins?

hemant gethemant at gmail.com
Tue Jan 22 18:27:55 EST 2008


Hi,

On Jan 22, 2008 8:44 PM, James Howison <james at howison.name> wrote:
>
>
> On Jan 22, 2008, at 4:03 AM, hemant wrote:
>
> > Hi,
> >
> > On Jan 22, 2008 9:27 AM, James Howison <james at howison.name> wrote:
> >> I'm using a plugin which adds a method to ActiveRecord::Base
> >>
> >> http://similetimelinerailshelper.googlecode.com/svn/trunk/simile_timeline/
> >>
> >> This adds an "acts_as" type declaration to the Models, via the file
> >> in
> >> vendor/plugins/simile_timeline/lib/simile_timeline.rb Rails is
> >> working
> >> with these declarations, and they are being used successfully in
> >> 'regular Rails'.
> >>
> >> When I run script/backgroundrb start, I get an error saying that
> >> method is not found (error follows sig).  Backgroundrb is able to
> >> start up with those acts_as declarations commented out.
> >>
> >> Presumably I need to require the plugin file somewhere, but I
> >> wondered
> >> if backgroundrb might be meant to load the same things as Rails, by
> >> default.
> >>
> >> Thanks,
> >> James
> >>
> >> [james at MinistryOfInformation2]$script/backgroundrb start
> >> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
> >> base.rb:1532:in `method_missing': undefined method
> >> `acts_as_simile_timeline_event' for #<Class:0x11655fc>
> >> (NoMethodError)
> >>        from /Users/james/Documents/University/Syracuse/Research/
> >> Dissertation/
> >> fromSVN/Dissertation/genrebrowser/app/models/event.rb:9
> >>        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> >> `gem_original_require'
> >>        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> >> `require'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:496:in `require'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:342:in `new_constants_in'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:496:in `require'
> >>        from /Users/james/Documents/University/Syracuse/Research/
> >> Dissertation/
> >> fromSVN/Dissertation/genrebrowser/vendor/plugins/backgroundrb/
> >> framework/packet.rb:10
> >>        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> >> `gem_original_require'
> >>        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> >> `require'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:496:in `require'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:342:in `new_constants_in'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> >> active_support/dependencies.rb:496:in `require'
> >>        from script/backgroundrb:16
> >
> > Which version of BackgrounDRb you are running? Use either trunk or
> > 1.0.1.
> > I remember version 1.0 has aggresive loading of models and hence you
> > will get errors, if your model requires other plugins.
> > But moving to 1.0.1 and trunk, I removed aggresive loading and model
> > environment is loaded same as rails loads them.
> >
> > Tell me the version, I will have a look at issue.
>
> Thanks.  Initially I had used piston on the trunk, but now I've used
> svn:externals as in the README file:
>
> [james at MinistryOfInformation2]$svn propedit svn:externals vendor/plugins
>
> backgroundrb http://svn.devjavu.com/backgroundrb/trunk
> <snip>
> ~
> ~
> "svn-prop.tmp" 1L, 55C written
> Set new value for property 'svn:externals' on 'vendor/plugins'
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
> [james at MinistryOfInformation2]$svn up vendor/plugins
>
> Fetching external item into 'vendor/plugins/backgroundrb'
> A    vendor/plugins/backgroundrb/test
> A    vendor/plugins/backgroundrb/test/meta_worker_test.rb
> A    vendor/plugins/backgroundrb/test/backgroundrb_test.rb
> A    vendor/plugins/backgroundrb/test/master_worker_test.rb
> A    vendor/plugins/backgroundrb/test/bdrb_test_helper.rb
> A    vendor/plugins/backgroundrb/cron_trigger.patch
> A    vendor/plugins/backgroundrb/Rakefile
> A    vendor/plugins/backgroundrb/LICENSE
> A    vendor/plugins/backgroundrb/tasks
> A    vendor/plugins/backgroundrb/tasks/backgroundrb_tasks.rake
> A    vendor/plugins/backgroundrb/TODO.org
> A    vendor/plugins/backgroundrb/framework
> A    vendor/plugins/backgroundrb/framework/packet_guid.rb
> A    vendor/plugins/backgroundrb/framework/cpu_worker.rb
> A    vendor/plugins/backgroundrb/framework/event.rb
> A    vendor/plugins/backgroundrb/framework/packet_master.rb
> A    vendor/plugins/backgroundrb/framework/bin_parser.rb
> A    vendor/plugins/backgroundrb/framework/nbio.rb
> A    vendor/plugins/backgroundrb/framework/class_helpers.rb
> A    vendor/plugins/backgroundrb/framework/core.rb
> A    vendor/plugins/backgroundrb/framework/buftok.rb
> A    vendor/plugins/backgroundrb/framework/deferrable.rb
> A    vendor/plugins/backgroundrb/framework/callback.rb
> A    vendor/plugins/backgroundrb/framework/double_keyed_hash.rb
> A    vendor/plugins/backgroundrb/framework/connection.rb
> A    vendor/plugins/backgroundrb/framework/periodic_event.rb
> A    vendor/plugins/backgroundrb/framework/io_worker.rb
> A    vendor/plugins/backgroundrb/framework/disconnect_error.rb
> A    vendor/plugins/backgroundrb/framework/pimp.rb
> A    vendor/plugins/backgroundrb/framework/packet.rb
> A    vendor/plugins/backgroundrb/framework/worker.rb
> A    vendor/plugins/backgroundrb/framework/meta_pimp.rb
> A    vendor/plugins/backgroundrb/README
> A    vendor/plugins/backgroundrb/script
> A    vendor/plugins/backgroundrb/script/backgroundrb
> A    vendor/plugins/backgroundrb/script/bdrb_test_helper.rb
> A    vendor/plugins/backgroundrb/init.rb
> A    vendor/plugins/backgroundrb/config
> A    vendor/plugins/backgroundrb/config/backgroundrb.yml
> A    vendor/plugins/backgroundrb/server
> A    vendor/plugins/backgroundrb/server/meta_worker.rb
> A    vendor/plugins/backgroundrb/server/trigger.rb
> A    vendor/plugins/backgroundrb/server/cron_trigger.rb
> A    vendor/plugins/backgroundrb/server/invalid_dump_error.rb
> A    vendor/plugins/backgroundrb/server/master_worker.rb
> A    vendor/plugins/backgroundrb/server/log_worker.rb
> A    vendor/plugins/backgroundrb/lib
> A    vendor/plugins/backgroundrb/lib/bdrb_conn_error.rb
> A    vendor/plugins/backgroundrb/lib/backgroundrb.rb
> A    vendor/plugins/backgroundrb/install.rb
> A    vendor/plugins/backgroundrb/generators
> A    vendor/plugins/backgroundrb/generators/worker
> A    vendor/plugins/backgroundrb/generators/worker/worker_generator.rb
> A    vendor/plugins/backgroundrb/generators/worker/USAGE
> A    vendor/plugins/backgroundrb/generators/worker/templates
> A    vendor/plugins/backgroundrb/generators/worker/templates/
> unit_test.rb
> A    vendor/plugins/backgroundrb/generators/worker/templates/worker.rb
> A    vendor/plugins/backgroundrb/MIT-LICENSE
> A    vendor/plugins/backgroundrb/uninstall.rb
> A    vendor/plugins/backgroundrb/examples
> A    vendor/plugins/backgroundrb/examples/god_worker.rb
> A    vendor/plugins/backgroundrb/examples/foo_controller.rb
> A    vendor/plugins/backgroundrb/examples/worker_tests
> A    vendor/plugins/backgroundrb/examples/worker_tests/
> god_worker_test.rb
> A    vendor/plugins/backgroundrb/examples/workers
> A    vendor/plugins/backgroundrb/examples/workers/xmpp_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/server_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/rss_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/world_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/error_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/god_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/renewal_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/model_worker.rb
> A    vendor/plugins/backgroundrb/examples/workers/foo_worker.rb
> Updated external to revision 312.
>
> Updated to revision 339.
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
> [james at MinistryOfInformation2]$svn commit -m 'added backgroundrb using
> externals'
> Sending        genrebrowser/app/models/event.rb
> Sending        genrebrowser/vendor/plugins
> Transmitting file data .
> Committed revision 340.
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
> [james at MinistryOfInformation2]$svn st
> ?      tmp
> ?      test/bdrb_test_helper.rb
> ?      script/backgroundrb
> ?      config/backgroundrb.yml
> ?      lib/workers
> X      vendor/plugins/backgroundrb
> ?      vendor/plugins/acts_as_list
>
> Performing status on external item at 'vendor/plugins/backgroundrb'
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
> [james at MinistryOfInformation2]$rake backgroundrb:setup
> (in /Users/james/Documents/University/Syracuse/Research/Dissertation/
> fromSVN/Dissertation/genrebrowser)
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
> [james at MinistryOfInformation2]$script/backgroundrb start
> /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
> base.rb:1532:in `method_missing': undefined method
> `acts_as_simile_timeline_event' for #<Class:0x125bfd8> (NoMethodError)
>         from /Users/james/Documents/University/Syracuse/Research/Dissertation/
> fromSVN/Dissertation/genrebrowser/app/models/event.rb:9
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require'
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:496:in `require'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:342:in `new_constants_in'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:496:in `require'
>         from /Users/james/Documents/University/Syracuse/Research/Dissertation/
> fromSVN/Dissertation/genrebrowser/vendor/plugins/backgroundrb/
> framework/packet.rb:10
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require'
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:496:in `require'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:342:in `new_constants_in'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/
> active_support/dependencies.rb:496:in `require'
>         from script/backgroundrb:16
> $~/Documents/University/Syracuse/Research/Dissertation/fromSVN/
> Dissertation/genrebrowser
>
> I get the same error using the "acts_as_list" plugin, installed using
> script/plugin.
>


Looks like you are having a model called event and backgroundrb has a
class called Event and hence when bdrb is trying to load event class
of its own, its loading your model and its failing.

Sadly to overcome this, you will have to perhaps rename your model.


More information about the Backgroundrb-devel mailing list