aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.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 /actionpack/lib/action_view/helpers/form_helper.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 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 52a640abf3..7ea2ea2d5a 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