diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-07-28 19:04:34 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-07-28 19:06:14 -0700 |
commit | c4d1075bd366e89a070afd5d6bf859af276c9507 (patch) | |
tree | 36e057ca8037693ac41938feab353eb2a2b189ca /activemodel/lib/active_model | |
parent | 9533e0eca76b1df68a90e1ebe395d7b6a59d8e91 (diff) | |
download | rails-c4d1075bd366e89a070afd5d6bf859af276c9507.tar.gz rails-c4d1075bd366e89a070afd5d6bf859af276c9507.tar.bz2 rails-c4d1075bd366e89a070afd5d6bf859af276c9507.zip |
Add support for error_messages_for(@obj)
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/naming.rb | 3 |
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 |