diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-19 16:10:24 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-19 16:10:24 +0200 |
commit | 8037fee9ff1dd13c421e6689229457c1ef084074 (patch) | |
tree | c60b2bf3e297be3e1bccb64ffd034acb137a7aa8 /activesupport/lib/active_support/core_ext/module/model_naming.rb | |
parent | 908b5305d4446433433313e315deb4083c58233e (diff) | |
parent | 9f7eaea201b2f408d9effbf82f2731957e284adf (diff) | |
download | rails-8037fee9ff1dd13c421e6689229457c1ef084074.tar.gz rails-8037fee9ff1dd13c421e6689229457c1ef084074.tar.bz2 rails-8037fee9ff1dd13c421e6689229457c1ef084074.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/model_naming.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/model_naming.rb | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/model_naming.rb b/activesupport/lib/active_support/core_ext/module/model_naming.rb deleted file mode 100644 index 13420bab07..0000000000 --- a/activesupport/lib/active_support/core_ext/module/model_naming.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'active_support/inflector' - -module ActiveSupport - class ModelName < String - attr_reader :singular, :plural, :element, :collection, :partial_path - alias_method :cache_key, :collection - - def initialize(name) - super - @singular = ActiveSupport::Inflector.underscore(self).tr('/', '_').freeze - @plural = ActiveSupport::Inflector.pluralize(@singular).freeze - @element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze - @collection = ActiveSupport::Inflector.tableize(self).freeze - @partial_path = "#{@collection}/#{@element}".freeze - end - end -end - -class Module - # Returns an ActiveSupport::ModelName object for module. It can be - # used to retrieve all kinds of naming-related information. - def model_name - @model_name ||= ActiveSupport::ModelName.new(name) - end -end |