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?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to