diff options
author | José Valim <jose.valim@gmail.com> | 2011-07-28 00:50:07 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-07-28 00:50:07 -0700 |
commit | 1b7db58a0604b01cd5c3a8d73b11158a48e45772 (patch) | |
tree | 69e237be48cc87fecce85c3e3c9cde1f844814d9 /actionpack/lib/action_view/helpers | |
parent | 8248052ee74465abfae5b202270e96c9fd93e785 (diff) | |
parent | bf812074fd55e7dcfa426d6c9bfd4d8d68922194 (diff) | |
download | rails-1b7db58a0604b01cd5c3a8d73b11158a48e45772.tar.gz rails-1b7db58a0604b01cd5c3a8d73b11158a48e45772.tar.bz2 rails-1b7db58a0604b01cd5c3a8d73b11158a48e45772.zip |
Merge pull request #2034 from Casecommons/to_path
Allow ActiveModel-compatible instances to define their own partial paths
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 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 |