aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/context.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-07-20 00:58:59 +0900
committerYehuda Katz <wycats@gmail.com>2009-07-20 00:58:59 +0900
commit13e18dd94000cef2b2058b96d62de16b7d3a2200 (patch)
tree54b5cbd18b31066744e67e226d8d603f70a5f8c6 /actionpack/lib/action_view/context.rb
parent5ffaaa71d149c9807260c950c9a61d01fe734827 (diff)
downloadrails-13e18dd94000cef2b2058b96d62de16b7d3a2200.tar.gz
rails-13e18dd94000cef2b2058b96d62de16b7d3a2200.tar.bz2
rails-13e18dd94000cef2b2058b96d62de16b7d3a2200.zip
Update some tests and add a to_model to form helpers
Diffstat (limited to 'actionpack/lib/action_view/context.rb')
-rw-r--r--actionpack/lib/action_view/context.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/context.rb b/actionpack/lib/action_view/context.rb
index 63651fa3f1..f212fe25eb 100644
--- a/actionpack/lib/action_view/context.rb
+++ b/actionpack/lib/action_view/context.rb
@@ -2,7 +2,7 @@ module ActionView
module CompiledTemplates #:nodoc:
# holds compiled template code
end
-
+
# ActionView contexts are supplied to ActionController
# to render template. The default ActionView context
# is ActionView::Base.
@@ -10,7 +10,7 @@ module ActionView
# In order to work with ActionController, a Context
# must implement:
#
- # Context.for_controller[controller] Create a new ActionView instance for a
+ # Context.for_controller[controller] Create a new ActionView instance for a
# controller
# Context#_render_partial_from_controller[options]
# - responsible for setting options[:_template]
@@ -36,5 +36,9 @@ module ActionView
module Context
include CompiledTemplates
attr_accessor :output_buffer
+
+ def convert_to_model(object)
+ object.respond_to?(:to_model) ? object.to_model : object
+ end
end
end \ No newline at end of file