Commit Graph

24 Commits

Author SHA1 Message Date
Carlos Antonio da Silva
67c96ab024 Move render_to_body logic to return a spaced string to AC::Rendering
This seems to be required only when calling render :partial with an
empty collection from a controller. This call happens to return no
content, letting the response body empty, which means to Rails that it
should go on and try to find a template to render based on the current
action name, thus failing hard.

Although tests keep all green, we need to check a better way to fix
this.
2012-01-17 10:04:38 -02:00
Vasiliy Ermolovich
a7ba8e1fb3 remove File#to_path alias 2011-12-25 22:22:22 +03:00
José Valim
7da88c5b29 Remove stream at the class level.
This is because only template rendering works with streaming.
Setting it at the class level was also changing the behavior
of JSON and XML responses, closes #1337.
2011-07-06 20:24:30 -03:00
Guillermo Iguaran
c2c8ef57d6 Remove trailing white-spaces 2011-06-05 10:34:40 -05:00
José Valim
3cca86641e Update CHANGELOG. 2011-05-03 01:04:57 +02:00
Xavier Noria
2db538c8a8 made a copy-edit pass on the streaming RDoc 2011-05-02 01:26:53 +02:00
José Valim
8dbee3aba6 Streaming docs. 2011-05-01 14:50:42 +02:00
José Valim
b735761385 Introduce view renderer. 2011-05-01 13:40:13 +02:00
José Valim
069e9b004f Do not stream on HTTP/1.0. 2011-04-19 15:04:28 +02:00
José Valim
389d15ef13 Body... wanna *stream* my body? Body... such a thrill my body!
Added stream as class level method to make it explicit when to stream.
Render also accepts :stream as option.
2011-04-18 08:55:41 +02:00
José Valim
7a152ab012 Rename it to DataStreaming. 2011-04-18 08:17:47 +02:00
John Firebaugh
b1047888fb render :text => proc { ... } is no longer supported. 2010-10-04 11:14:42 -07:00
Carlos Antonio da Silva
11fccc5f06 Cleanup deprecation warnings in Action Controller
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:40:45 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d0b414564e919f67d339fac067a56e6.
2010-09-02 21:11:03 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
José Valim
51d2db0a63 Add missing require to metal/streaming.rb 2010-07-20 09:56:16 +02:00
Carlhuda
5e2bd08023 Makes send_file work again by deferring to Rack::Sendfile.
* Add the Rack::Sendfile middleware
  * Make the header to use configurable via config.action_dispatch.x_sendfile_header (default to "X-Sendfile"). 
  * Add Railties tests to confirm that these work
  * Remove the :stream, :buffer_size, and :x_senfile default options to send_file
  * Change the log subscriber to always say "Sent file"
  * Add deprecation warnings for options that are now no-ops

Note that servers can configure this by setting X-Sendfile-Type. Hosting companies and those creating packages of servers specially designed for Rails applications are encouraged to specify this header so that this can work transparently.
2010-02-23 17:06:35 -08:00
Carlhuda
3345af61fb Fix streaming by having it create a File object, which can be handled by Rack servers as appropriate 2010-02-23 15:37:17 -08:00
José Valim
da5978c223 Add subscriber for ActionPack and move all logging inside it. 2010-01-13 01:19:23 +01:00
David Heinemeier Hansson
83f4d86a93 Rename the RenderingController module to just plain Rendering 2009-12-20 17:15:31 -08:00
Xavier Noria
004db18cb0 String#bytesize is not needed for Ruby >= 1.8.7 2009-11-09 22:16:51 +01:00
Yehuda Katz
0adbeeb0c9 Got overhead down from 127 to 85. All tests pass:
* Tentatively replaced HeaderHash with SimpleHeaderHash, which does not preserve
    case but does handle converting Arrays to Strings in to_hash. This requires
    further discussion.
  * Moved default_charset to ActionDispatch::Response to avoid having to hop over
    to ActionController. Ideally, this would be a constant on AD::Response, but
    some tests expect to be able to change it dynamically and I didn't want to change
    them yet.
  * Completely override #initialize from Rack::Response. Previously, it was creating
    a HeaderHash, and then we were creating an entirely new one. There is no way to
    call super without incurring the overhead of creating a HeaderHash.
  * Override #write from Rack::Response. Its implementation tracks Content-Length,
    and doing so adds additional overhead that could be mooted if other middleware
    changes the body. It is more efficiently done at the top-level server.
  * Change sending_file to an instance_variable instead of header inspection. In
    general, if a state is important, it should be set as a property of the response
    not reconstructed later.
  * Set the Etag to @body instead of .body. AS::Cache.expand_cache_key handles
    Arrays fine, and it's more efficient to let it handle the body parts, since
    it is not forced to create a joined String.
  * If we detect the default cache control case, just set it, rather than setting
    the constituent parts and then running the normal (expensive) code to generate
    the string.
2009-08-11 15:03:53 -07:00
José Valim
aed135d3e2 Renamed presenter to renderer, added some documentation and defined its API. 2009-08-07 17:17:51 +02:00
Yehuda Katz
bd6b61be88 Rename /base to /metal and make base.rb and metal.rb top-level to reflect their module locations 2009-08-06 19:52:11 -03:00