aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/naming.rb
diff options
context:
space:
mode:
authorGrant Hutchins & Peter Jaros <pair+grant+pjaros@pivotallabs.com>2011-07-08 17:54:15 -0400
committerXavier Noria <fxn@hashref.com>2011-08-13 16:22:21 -0700
commit6e671a8536f17b6f23b5251652015ce8c1557f1f (patch)
tree98177efb062b64203d0b33122515fd7b72909392 /activemodel/lib/active_model/naming.rb
parenta636a9358e184bd1a3e2d2522584247be7045cdf (diff)
downloadrails-6e671a8536f17b6f23b5251652015ce8c1557f1f.tar.gz
rails-6e671a8536f17b6f23b5251652015ce8c1557f1f.tar.bz2
rails-6e671a8536f17b6f23b5251652015ce8c1557f1f.zip
Let ActiveModel instances define partial paths.
Deprecate ActiveModel::Name#partial_path. Now you should call #to_path directly on ActiveModel instances.
Diffstat (limited to 'activemodel/lib/active_model/naming.rb')
-rw-r--r--activemodel/lib/active_model/naming.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 4c1a82f413..26fa3062eb 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -1,12 +1,15 @@
require 'active_support/inflector'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/module/introspection'
+require 'active_support/core_ext/module/deprecation'
module ActiveModel
class Name < String
attr_reader :singular, :plural, :element, :collection, :partial_path, :route_key, :param_key, :i18n_key
alias_method :cache_key, :collection
+ deprecate :partial_path => "ActiveModel::Name#partial_path is deprecated. Call #to_path on model instances directly instead."
+
def initialize(klass, namespace = nil, name = nil)
name ||= klass.name
super(name)