I have two Const with the same name; One of them is the global const, and the other under the name Admin. But I need to distinguish them: the global is already defined, and the scope should be automatically determined if it is not already defined:
A = 'A Global Const' module Admin A = 'A Const within the Admin namespace' if const_defined? 'A'
But if global A is defined, "const_defind?" part will always be returned!
I even tried:
... if defined? A ... if self.const_defined? 'A' ... if Object.const_get('Admin').const_defined? 'A'
Always right!
I need to distinguish them because I need to use A in and Admin :: A two forms,
Similar to the PostsController situation for general use and Admin :: PostsController for use by the administrator,
Help!
source share