Namespace problem

Hi,

I have a problem with namespacing. I had a model called Country and I
have added the acts as Globalize plugin which also has a plugin called
Country.

Now of course I have conflicts through my code. Is there a way to
address models correctly to resolve this?

Thanks,

Keith

Keith D. wrote:

Hi,

I have a problem with namespacing. I had a model called Country and I
have added the acts as Globalize plugin which also has a plugin called
Country.

Now of course I have conflicts through my code. Is there a way to
address models correctly to resolve this?

Thanks,

Keith

To me this sounds like a design error in the “acts as Globalize plugin”
plugins should not be polluting the global namespace like that. My
first guess therefore is to ‘require’ the plugin, but not ‘include’ its
name space. I am not familiar with this plugin, but most keep themselves
in a module to prevent just this problem.

If that is not the case, you really have two options:

  • cajole, shoehorn, or monkeypatch your plugin into a separate
    namespace
  • Bite the bullet an change your ‘Country’ to something else.

If you find the plugin useful, you might also consider adding namespace
protections to it and submitting a patch to the maintainer so other who
use the code will not have the same issue. (or you could be a cheep
sleeze and just send an e-mail to the maintainer asking them to do it
for you.)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs