aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-01 10:33:30 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-01 13:40:12 +0200
commitd08f65118cc328de5493a68db33a155487f5fceb (patch)
treed46ea02ef1b754a81bcd8412a970b849aba45fcb /actionpack/lib/action_view/helpers/form_helper.rb
parente68b7a001de0959fcfb90b9d8c82b6b0bc1ccfb6 (diff)
downloadrails-d08f65118cc328de5493a68db33a155487f5fceb.tar.gz
rails-d08f65118cc328de5493a68db33a155487f5fceb.tar.bz2
rails-d08f65118cc328de5493a68db33a155487f5fceb.zip
Start abstracting the renderer.
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index efe30441b1..68db17c254 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -102,6 +102,11 @@ module ActionView
include FormTagHelper
include UrlHelper
+ # Converts the given object to an ActiveModel compliant one.
+ def convert_to_model(object)
+ object.respond_to?(:to_model) ? object.to_model : object
+ end
+
# Creates a form and a scope around a specific model object that is used
# as a base for questioning about values for the fields.
#