aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-07-30 14:18:53 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-07-30 14:18:53 +0100
commit915cf5747a78f28f2b25c48574031db60c3a18ae (patch)
tree048746387ddaaed418670c86451856675b8d369f /activemodel
parent23f5e7e966defaaa1511eca57bd8de47f95cb7d9 (diff)
parentd83b1828577c268de56e1b3942e16002c9efdd57 (diff)
downloadrails-915cf5747a78f28f2b25c48574031db60c3a18ae.tar.gz
rails-915cf5747a78f28f2b25c48574031db60c3a18ae.tar.bz2
rails-915cf5747a78f28f2b25c48574031db60c3a18ae.zip
Merge commit 'mainstream/master'
Conflicts: railties/guides/source/active_support_overview.textile
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/naming.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index ffb44e3824..b8c2a367b4 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -2,7 +2,7 @@ require 'active_support/inflector'
module ActiveModel
class Name < String
- attr_reader :singular, :plural, :element, :collection, :partial_path
+ attr_reader :singular, :plural, :element, :collection, :partial_path, :human
alias_method :cache_key, :collection
def initialize(name)
@@ -10,6 +10,7 @@ module ActiveModel
@singular = ActiveSupport::Inflector.underscore(self).tr('/', '_').freeze
@plural = ActiveSupport::Inflector.pluralize(@singular).freeze
@element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze
+ @human = @element.gsub(/_/, " ")
@collection = ActiveSupport::Inflector.tableize(self).freeze
@partial_path = "#{@collection}/#{@element}".freeze
end