I have a module like this:
module Controller
module LocaleModels
def self.included(base)
base.send :include, InstanceMethods
end
module InstanceMethods
def locale_Lexeme; constantize_model('Lexeme') end
def locale_Synthetic; constantize_model('Synthetic') end
def locale_Property; constantize_model('Property') end
private
def constantize_model(common_part)
eval(I18n.locale.capitalize + '::' + common_part).constantize
end
end
end
end
But I kept getting
NoMethodError (undefined method `constantize' for #<Class:0x2483b0c>)
I guess I cannot use 'constantize' in a custom module.
But can you please offer some workaround?