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

hemant gethemant at gmail.com
Wed Jan 23 00:05:55 EST 2008

Hi James,

On Jan 23, 2008 6:51 AM, James Howison <james at howison.name> wrote:
> On Jan 22, 2008, at 6:51 PM, Yves-Eric Martin wrote:
> > hemant wrote:
> >> 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
> I'm certainly able to change my Model names, since it's early in the
> game for this application, but seems that there is a more general
> issue with namespaces here.  Presumably the same thing would happen if
> I had a file matching any of the requires in packet.rb (including
> pimp ;)
> > Could changing "Event" to "Packet::Event" help bdrb load the correct
> > class?
> Seems that the issue comes from the "require 'event'" line at bdrb's
> packet.rb:10 file.  That line is picking up my RAILS_ROOT/app/model/
> event.rb file.
> Changing that line to:
> require './vendor/plugins/backgroundrb/framework/event.rb'
> seems to work, at least bdrb is able to start.

Get rid of your existing copy and sync with trunk. bdrb will no longer
conflict with any of your model files.

> I'm very far from really understanding Ruby's namespaces, but the call
> to dbrb's Event.new on core.rb:215 is inside a Packet module ...
> perhaps that will protect it. Perhaps better, though, if bdrb could be
> very pedantic about the namespacing it uses (either includes or full
> Package names for it's internal classes, as suggested above).  Maybe
> even a top level BDRB package for everything?
> Thx,
> James
> ps. Is there any smart automated way to change a Rails Model's name,
> it is scattered all over the place, in files and filenames, not to
> mention the database?

Unless you use netbeans or something, I guess no. And please don't
rename the model if you have lots of code written around it.

Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.


More information about the Backgroundrb-devel mailing list