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

hemant gethemant at gmail.com
Wed Jan 23 00:25:27 EST 2008


On Jan 23, 2008 8:15 AM, James Howison <james at howison.name> wrote:
>
> On Jan 22, 2008, at 9:20 PM, Yves-Eric Martin wrote:
>
> > James Howison wrote:
> >> 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?
> >
> > Yes, it can be a real pain to rename a model. That is why the
> > "rename your model" solution made me wince...
> >
> > As you pointed out, plugins should be very verbose with their
> > namespace/paths in order to avoid conflicting with the main
> > application. Now a small problem with
> >
> > require './vendor/plugins/backgroundrb/framework/event.rb'
> >
> > is that the path is hardcoded. It could be something else (I could
> > have checked out the plugin code into ./vendor/plugins/BackgrounDRb).
>
> Indeed.
>
> > I went through some other plugins code to look for best practices,
> > and it looks like a better way to do it would be:
> >
> > require File.dirname(__FILE__) + '/event'
> >
> > Can you check and see if that works?
>
> Yes, that seems to work (bdrb starts ok), nice one.  Does that take
> care of potential namespace issues, though, maybe still need a unique
> surrounding package?

We didn't had namespace issues, Event class was already inside packet
model so properly namespaced.


More information about the Backgroundrb-devel mailing list