From bf812074fd55e7dcfa426d6c9bfd4d8d68922194 Mon Sep 17 00:00:00 2001 From: Grant Hutchins & Peter Jaros Date: Fri, 8 Jul 2011 17:54:15 -0400 Subject: Let ActiveModel instances define partial paths. Deprecate ActiveModel::Name#partial_path. Now you should call #to_path directly on ActiveModel instances. --- actionpack/lib/action_view/helpers/form_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/form_helper.rb') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 974c963d44..c835aa6f15 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1227,8 +1227,12 @@ module ActionView parent_builder.multipart = multipart if parent_builder end - def self.model_name - @model_name ||= Struct.new(:partial_path).new(name.demodulize.underscore.sub!(/_builder$/, '')) + def self.to_path + @_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '') + end + + def to_path + self.class.to_path end def to_model -- cgit v1.2.3