Skip to content

Commit

Permalink
Deprecate stream at the class level.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
josevalim committed Jul 6, 2011
1 parent 3a92bc7 commit a05d59f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
20 changes: 6 additions & 14 deletions actionpack/lib/action_controller/metal/streaming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@ module ActionController #:nodoc:
#
# == Examples
#
# Streaming can be added to a controller easily, all you need to do is
# call +stream+ in the controller class:
#
# class PostsController
# stream
# end
#
# The +stream+ method accepts the same options as +before_filter+ and friends:
#
# class PostsController
# stream :only => :index
# end
#
# You can also selectively turn on streaming for specific actions:
# Streaming can be added to a given template easily, all you need to do is
# to pass the :stream option.
#
# class PostsController
# def index
Expand Down Expand Up @@ -72,6 +60,9 @@ module ActionController #:nodoc:
# render :stream => true
# end
#
# Notice that :stream only works with templates. Rendering :json
# or :xml with :stream won't work.
#
# == Communication between layout and template
#
# When streaming, rendering happens top-down instead of inside-out.
Expand Down Expand Up @@ -215,6 +206,7 @@ module ClassMethods
# Render streaming templates. It accepts :only, :except, :if and :unless as options
# to specify when to stream, as in ActionController filters.
def stream(options={})
ActiveSupport::Deprecation.warn "stream class method is deprecated. Please give the :stream option to render instead"
if defined?(Fiber)
before_filter :_stream_filter, options
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class BasicController < ActionController::Base
)]

layout "application"
stream :only => [:hello_world, :skip]

def hello_world
render :stream => true
end

def layout_exception
Expand Down

0 comments on commit a05d59f

Please sign in to comment.