aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <raasdnil@gmail.com>2010-01-21 11:42:22 +1100
committerJosé Valim and Mikel Lindsaar <raasdnil@gmail.com>2010-01-21 11:42:22 +1100
commitfbdbac2b88218e5e3e6087c67dacf7e755aa4106 (patch)
tree6fdec21b56ab90fc2ec83cbc38033439a9c84e74 /actionpack/lib/action_controller
parentd3da87ce771845f99bbdc04d6d6587b22655b063 (diff)
parentfa9f000246c2f6010f18bf40237d105b782873e2 (diff)
downloadrails-fbdbac2b88218e5e3e6087c67dacf7e755aa4106.tar.gz
rails-fbdbac2b88218e5e3e6087c67dacf7e755aa4106.tar.bz2
rails-fbdbac2b88218e5e3e6087c67dacf7e755aa4106.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb31
-rw-r--r--actionpack/lib/action_controller/metal.rb1
-rw-r--r--actionpack/lib/action_controller/metal/instrumentation.rb16
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb7
-rw-r--r--actionpack/lib/action_controller/translation.rb13
5 files changed, 19 insertions, 49 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index f86a61d791..21a811c004 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -4,6 +4,7 @@ module ActionController
include AbstractController::Callbacks
include AbstractController::Layouts
+ include AbstractController::Translation
include ActionController::Helpers
helper :all # By default, all helpers should be included
@@ -33,7 +34,6 @@ module ActionController
include ActionController::Streaming
include ActionController::HttpAuthentication::Basic::ControllerMethods
include ActionController::HttpAuthentication::Digest::ControllerMethods
- include ActionController::Translation
# Add instrumentations hooks at the bottom, to ensure they instrument
# all the methods properly.
@@ -74,17 +74,14 @@ module ActionController
@subclasses ||= []
end
- def _normalize_options(action = nil, options = {}, &blk)
- if action.is_a?(Hash)
- options, action = action, nil
- elsif action.is_a?(String) || action.is_a?(Symbol)
- key = case action = action.to_s
- when %r{^/} then :file
- when %r{/} then :template
- else :action
- end
- options.merge! key => action
- elsif action
+ def _normalize_options(action=nil, options={}, &blk)
+ case action
+ when NilClass
+ when Hash, String
+ options = super
+ when Symbol
+ options.merge! :action => action
+ else
options.merge! :partial => action
end
@@ -99,15 +96,5 @@ module ActionController
options[:update] = blk if block_given?
options
end
-
- def render(action = nil, options = {}, &blk)
- options = _normalize_options(action, options, &blk)
- super(options)
- end
-
- def render_to_string(action = nil, options = {}, &blk)
- options = _normalize_options(action, options, &blk)
- super(options)
- end
end
end
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 1819c0f886..57627a6f0b 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -60,6 +60,7 @@ module ActionController
# :api: private
def dispatch(name, env)
@_env = env
+ @_env['action_controller.instance'] = self
process(name)
to_a
end
diff --git a/actionpack/lib/action_controller/metal/instrumentation.rb b/actionpack/lib/action_controller/metal/instrumentation.rb
index 7b2b037c67..19c962bafa 100644
--- a/actionpack/lib/action_controller/metal/instrumentation.rb
+++ b/actionpack/lib/action_controller/metal/instrumentation.rb
@@ -32,18 +32,12 @@ module ActionController
end
end
- def render(*args, &block)
- if logger
- render_output = nil
-
- self.view_runtime = cleanup_view_runtime do
- Benchmark.ms { render_output = super }
- end
-
- render_output
- else
- super
+ def render(*args)
+ render_output = nil
+ self.view_runtime = cleanup_view_runtime do
+ Benchmark.ms { render_output = super }
end
+ render_output
end
def send_file(path, options={})
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index 74e50bb032..475ed54167 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -12,9 +12,10 @@ module ActionController
super
end
- def render(options)
- super
- self.content_type ||= options[:_template].mime_type.to_s
+ def render(*args)
+ args << {} unless args.last.is_a?(Hash)
+ super(*args)
+ self.content_type ||= args.last[:_template].mime_type.to_s
response_body
end
diff --git a/actionpack/lib/action_controller/translation.rb b/actionpack/lib/action_controller/translation.rb
deleted file mode 100644
index 65e9eddb0a..0000000000
--- a/actionpack/lib/action_controller/translation.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module ActionController
- module Translation
- def translate(*args)
- I18n.translate(*args)
- end
- alias :t :translate
-
- def localize(*args)
- I18n.localize(*args)
- end
- alias :l :localize
- end
-end \ No newline at end of file