Skip to content

Commit

Permalink
Remove some defined?(Http) checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehuda Katz + Carl Lerche committed Jun 17, 2009
1 parent 251a6e4 commit 8fdf3d7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ module ActionController
module FilterParameterLogging
extend ActiveSupport::Concern

# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
include AbstractController::Logger
end
include AbstractController::Logger

included do
include InstanceMethodsForNewBase
Expand Down
27 changes: 2 additions & 25 deletions actionpack/lib/action_controller/base/flash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ module Flash

included do
# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
include InstanceMethodsForNewBase
else
include InstanceMethodsForBase

alias_method_chain :perform_action, :flash
alias_method_chain :reset_session, :flash
end
include InstanceMethods
end

class FlashNow #:nodoc:
Expand Down Expand Up @@ -148,23 +141,7 @@ def use(key = nil, used = true)
end
end

module InstanceMethodsForBase #:nodoc:
protected
def perform_action_with_flash
perform_action_without_flash
if defined? @_flash
@_flash.store(session)
remove_instance_variable(:@_flash)
end
end

def reset_session_with_flash
reset_session_without_flash
remove_instance_variable(:@_flash) if defined?(@_flash)
end
end

module InstanceMethodsForNewBase #:nodoc:
module InstanceMethods #:nodoc:
protected
def process_action(method_name)
super
Expand Down
5 changes: 1 addition & 4 deletions actionpack/lib/action_controller/base/mime_responds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ def custom(mime_type, &block)

@responses[mime_type] ||= Proc.new do
# TODO: Remove this when new base is merged in
if defined?(Http)
@controller.formats = [mime_type.to_sym]
end

@controller.formats = [mime_type.to_sym]
@controller.content_type = mime_type
@controller.template.formats = [mime_type.to_sym]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ module RequestForgeryProtection
extend ActiveSupport::Concern

# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
include AbstractController::Helpers, Session
end
include AbstractController::Helpers, Session

included do
if defined?(ActionController::Http)
# Sets the token parameter name for RequestForgery. Calling +protect_from_forgery+
# sets it to <tt>:authenticity_token</tt> by default.
cattr_accessor :request_forgery_protection_token
# Sets the token parameter name for RequestForgery. Calling +protect_from_forgery+
# sets it to <tt>:authenticity_token</tt> by default.
cattr_accessor :request_forgery_protection_token

# Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode.
class_inheritable_accessor :allow_forgery_protection
self.allow_forgery_protection = true
end
# Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode.
class_inheritable_accessor :allow_forgery_protection
self.allow_forgery_protection = true

helper_method :form_authenticity_token
helper_method :protect_against_forgery?
Expand Down
4 changes: 1 addition & 3 deletions actionpack/lib/action_controller/base/verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ module Verification #:nodoc:
extend ActiveSupport::Concern

# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
include AbstractController::Callbacks, Session, Flash, Renderer
end
include AbstractController::Callbacks, Session, Flash, Renderer

# This module provides a class-level method for specifying that certain
# actions are guarded against being called without certain prerequisites
Expand Down
9 changes: 1 addition & 8 deletions actionpack/lib/action_controller/caching/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ def caches_action(*actions)

cache_filter = ActionCacheFilter.new(:layout => options.delete(:layout), :cache_path => options.delete(:cache_path), :store_options => options)

# TODO: Remove this once new base is swapped in.
if defined?(ActionController::Http)
around_filter cache_filter, filter_options
else
around_filter(filter_options) do |controller, action|
cache_filter.filter(controller, action)
end
end
around_filter cache_filter, filter_options
end
end

Expand Down
1 change: 1 addition & 0 deletions actionpack/test/abstract_unit.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
$:.unshift(File.dirname(__FILE__) + '/../../activemodel/lib')
$:.unshift(File.dirname(__FILE__) + '/lib')

$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
Expand Down
2 changes: 2 additions & 0 deletions actionpack/test/lib/controller/fake_models.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "active_model"

class Customer < Struct.new(:name, :id)
extend ActiveModel::Naming

Expand Down

0 comments on commit 8fdf3d7

Please sign in to comment.