instiki/vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb
Jacques Distler d4f97345db Rails 2.1.1
Among other things, a security fix.
2008-09-07 00:54:05 -05:00

23 lines
480 B
Ruby

module ActiveSupport
class ModelName < String
attr_reader :singular, :plural, :partial_path
def initialize(name)
super
@singular = underscore.tr('/', '_').freeze
@plural = @singular.pluralize.freeze
@partial_path = "#{tableize}/#{demodulize.underscore}".freeze
end
end
module CoreExt
module Module
module ModelNaming
def model_name
@model_name ||= ModelName.new(name)
end
end
end
end
end