diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-25 14:57:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-25 14:57:15 +0000 |
commit | 55a9c86e6228b4286df7fb59c326832b57aa0f54 (patch) | |
tree | 5cd73301e18bdbd5a03d50d42a3164a323dbe133 /actionpack/lib/action_controller | |
parent | 3b98b685163be795e3156ce75d5083689c137dd8 (diff) | |
download | rails-55a9c86e6228b4286df7fb59c326832b57aa0f54.tar.gz rails-55a9c86e6228b4286df7fb59c326832b57aa0f54.tar.bz2 rails-55a9c86e6228b4286df7fb59c326832b57aa0f54.zip |
Added failing tests for iphone
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7629 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index f12b3f9b80..9cd7d0e8cf 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -234,10 +234,9 @@ module ActionController #:nodoc: protected def render_with_a_layout(options = nil, &block) #:nodoc: - if template_with_options = options.is_a?(Hash) - response.template.template_format = options[:content_type].to_sym if options[:content_type] - end - + template_with_options = options.is_a?(Hash) + set_template_format(options) + if apply_layout?(template_with_options, options) && (layout = pick_layout(template_with_options, options)) assert_existence_of_template_file(layout) @@ -307,5 +306,13 @@ module ActionController #:nodoc: self.class.send(:layout_directory_exists_cache)[File.dirname(template_path)] end end + + def set_template_format(options) + if options.is_a?(Hash) && options[:content_type] + response.template.template_format = options[:content_type].to_sym + elsif params[:format] + response.template.template_format = Mime::Type.lookup(Mime::Type.lookup_by_extension(params[:format]).to_s).to_sym + end + end end end
\ No newline at end of file |