class Rails::Generators::Base
def self.generator_name
Rails::Generators::ModelGenerator will return "model" as generator name.
Removes the namespaces and get the generator name. For example,
def self.generator_name @generator_name ||= begin if generator = name.to_s.split('::').last generator.sub!(/Generator$/, '') generator.underscore end end end