diff options
author | Grant Hutchins & Peter Jaros <pair+grant+pjaros@pivotallabs.com> | 2011-07-08 17:54:15 -0400 |
---|---|---|
committer | Grant Hutchins & Peter Jaros <pair+grant+pjaros@pivotallabs.com> | 2011-07-25 16:05:24 -0400 |
commit | bf812074fd55e7dcfa426d6c9bfd4d8d68922194 (patch) | |
tree | 7e0f2861673407c7278a915134d4a5076dafa531 /actionpack/lib/action_view/helpers | |
parent | 8e0061128e8946d6e6fab68c078517db668ef050 (diff) | |
download | rails-bf812074fd55e7dcfa426d6c9bfd4d8d68922194.tar.gz rails-bf812074fd55e7dcfa426d6c9bfd4d8d68922194.tar.bz2 rails-bf812074fd55e7dcfa426d6c9bfd4d8d68922194.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')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 8 |
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 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 |