Merge pull request #5374 from nertzy/remove_deprecated_partial_path_from_active_model_naming

Remove ActiveModel::Naming#partial_path
This commit is contained in:
José Valim 2012-03-23 05:57:35 -07:00
commit 35e8de6344
2 changed files with 1 additions and 28 deletions

@ -6,13 +6,11 @@
module ActiveModel
class Name < String
attr_reader :singular, :plural, :element, :collection, :partial_path,
attr_reader :singular, :plural, :element, :collection,
:singular_route_key, :route_key, :param_key, :i18n_key
alias_method :cache_key, :collection
deprecate :partial_path => "ActiveModel::Name#partial_path is deprecated. Call #to_partial_path on model instances directly instead."
def initialize(klass, namespace = nil, name = nil)
name ||= klass.name
@ -27,7 +25,6 @@ def initialize(klass, namespace = nil, name = nil)
@element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze
@human = ActiveSupport::Inflector.humanize(@element).freeze
@collection = ActiveSupport::Inflector.tableize(self).freeze
@partial_path = "#{@collection}/#{@element}".freeze
@param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze
@i18n_key = self.underscore.to_sym

@ -25,12 +25,6 @@ def test_collection
assert_equal 'post/track_backs', @model_name.collection
end
def test_partial_path
assert_deprecated(/#partial_path.*#to_partial_path/) do
assert_equal 'post/track_backs/track_back', @model_name.partial_path
end
end
def test_human
assert_equal 'Track back', @model_name.human
end
@ -61,12 +55,6 @@ def test_collection
assert_equal 'blog/posts', @model_name.collection
end
def test_partial_path
assert_deprecated(/#partial_path.*#to_partial_path/) do
assert_equal 'blog/posts/post', @model_name.partial_path
end
end
def test_human
assert_equal 'Post', @model_name.human
end
@ -105,12 +93,6 @@ def test_collection
assert_equal 'blog/posts', @model_name.collection
end
def test_partial_path
assert_deprecated(/#partial_path.*#to_partial_path/) do
assert_equal 'blog/posts/post', @model_name.partial_path
end
end
def test_human
assert_equal 'Post', @model_name.human
end
@ -149,12 +131,6 @@ def test_collection
assert_equal 'articles', @model_name.collection
end
def test_partial_path
assert_deprecated(/#partial_path.*#to_partial_path/) do
assert_equal 'articles/article', @model_name.partial_path
end
end
def test_human
assert_equal 'Article', @model_name.human
end