How can I access a constant that is defined in a plugin?


(Gerhard Schlager) #1

I’d like to use the following constants in an import script.

What’s the scope of those constants if they are outside of a module? Is it even possible to use them somewhere else? If so, how?


(Jens Maier) #2
poll_plugin = Discourse.plugins.find {|p| p.metadata.name == "poll" }
poll_plugin.singleton_class.const_get(:POLLS_CUSTOM_FIELD)

Ruby…

http://weknowgifs.com/wp-content/uploads/2013/03/its-magic-shia-labeouf-gif.gif