Forum: Ruby on Rails detecting acts_as_x?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John S. (Guest)
on 2009-02-26 09:34
I'm writing an acts_as_x type plugin/gem and I need to know how to
detect which other acts_as plugins are installed so I can avoid name
conflicts. What's a simple way to do this?

Thanks

John S.
Frederick C. (Guest)
on 2009-02-26 10:36
(Received via mailing list)
On Feb 26, 7:34 am, John S. <removed_email_address@domain.invalid>
wrote:
> I'm writing an acts_as_x type plugin/gem and I need to know how to
> detect which other acts_as plugins are installed so I can avoid name
> conflicts. What's a simple way to do this?

Well there's not much in the way of conventions or ways to list other
installed plugins. You may find the easiest way is to namespace your
stuff (so install of having MyAwesomeModule make it
YourOrganisation::MyAwesomeModule), but as far as you and some other
plugin both adding an acts_as_foo method you're probably out of luck.
You can find out if the method you are about to add is already there,
but depending on plugin load order you might load before the
conflicting plugin.

Fred
John S. (Guest)
on 2009-02-26 11:44
Frederick C. wrote:
> On Feb 26, 7:34�am, John S. <removed_email_address@domain.invalid>
> wrote:
>> I'm writing an acts_as_x type plugin/gem and I need to know how to
>> detect which other acts_as plugins are installed so I can avoid name
>> conflicts. What's a simple way to do this?
>
> Well there's not much in the way of conventions or ways to list other
> installed plugins. You may find the easiest way is to namespace your
> stuff (so install of having MyAwesomeModule make it
> YourOrganisation::MyAwesomeModule), but as far as you and some other
> plugin both adding an acts_as_foo method you're probably out of luck.
> You can find out if the method you are about to add is already there,
> but depending on plugin load order you might load before the
> conflicting plugin.
>
> Fred
I rather thought that might be the case, I'll name space myself and add
a switch to the initialization to determine whether to use probably
unique but awkward method names or simpler but probably conflicting
method names.
This topic is locked and can not be replied to.