Skip to content

Commit 8fdf3d7

Browse files
author
Yehuda Katz + Carl Lerche
committed
Remove some defined?(Http) checks
1 parent 251a6e4 commit 8fdf3d7

File tree

8 files changed

+16
-55
lines changed

8 files changed

+16
-55
lines changed

actionpack/lib/action_controller/base/filter_parameter_logging.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ module ActionController
22
module FilterParameterLogging
33
extend ActiveSupport::Concern
44

5-
# TODO : Remove the defined? check when new base is the main base
6-
if defined?(ActionController::Http)
7-
include AbstractController::Logger
8-
end
5+
include AbstractController::Logger
96

107
included do
118
include InstanceMethodsForNewBase

actionpack/lib/action_controller/base/flash.rb

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ module Flash
3333

3434
included do
3535
# TODO : Remove the defined? check when new base is the main base
36-
if defined?(ActionController::Http)
37-
include InstanceMethodsForNewBase
38-
else
39-
include InstanceMethodsForBase
40-
41-
alias_method_chain :perform_action, :flash
42-
alias_method_chain :reset_session, :flash
43-
end
36+
include InstanceMethods
4437
end
4538

4639
class FlashNow #:nodoc:
@@ -148,23 +141,7 @@ def use(key = nil, used = true)
148141
end
149142
end
150143

151-
module InstanceMethodsForBase #:nodoc:
152-
protected
153-
def perform_action_with_flash
154-
perform_action_without_flash
155-
if defined? @_flash
156-
@_flash.store(session)
157-
remove_instance_variable(:@_flash)
158-
end
159-
end
160-
161-
def reset_session_with_flash
162-
reset_session_without_flash
163-
remove_instance_variable(:@_flash) if defined?(@_flash)
164-
end
165-
end
166-
167-
module InstanceMethodsForNewBase #:nodoc:
144+
module InstanceMethods #:nodoc:
168145
protected
169146
def process_action(method_name)
170147
super

actionpack/lib/action_controller/base/mime_responds.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ def custom(mime_type, &block)
120120

121121
@responses[mime_type] ||= Proc.new do
122122
# TODO: Remove this when new base is merged in
123-
if defined?(Http)
124-
@controller.formats = [mime_type.to_sym]
125-
end
126-
123+
@controller.formats = [mime_type.to_sym]
127124
@controller.content_type = mime_type
128125
@controller.template.formats = [mime_type.to_sym]
129126

actionpack/lib/action_controller/base/request_forgery_protection.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@ module RequestForgeryProtection
66
extend ActiveSupport::Concern
77

88
# TODO : Remove the defined? check when new base is the main base
9-
if defined?(ActionController::Http)
10-
include AbstractController::Helpers, Session
11-
end
9+
include AbstractController::Helpers, Session
1210

1311
included do
14-
if defined?(ActionController::Http)
15-
# Sets the token parameter name for RequestForgery. Calling +protect_from_forgery+
16-
# sets it to <tt>:authenticity_token</tt> by default.
17-
cattr_accessor :request_forgery_protection_token
12+
# Sets the token parameter name for RequestForgery. Calling +protect_from_forgery+
13+
# sets it to <tt>:authenticity_token</tt> by default.
14+
cattr_accessor :request_forgery_protection_token
1815

19-
# Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode.
20-
class_inheritable_accessor :allow_forgery_protection
21-
self.allow_forgery_protection = true
22-
end
16+
# Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode.
17+
class_inheritable_accessor :allow_forgery_protection
18+
self.allow_forgery_protection = true
2319

2420
helper_method :form_authenticity_token
2521
helper_method :protect_against_forgery?

actionpack/lib/action_controller/base/verification.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module Verification #:nodoc:
33
extend ActiveSupport::Concern
44

55
# TODO : Remove the defined? check when new base is the main base
6-
if defined?(ActionController::Http)
7-
include AbstractController::Callbacks, Session, Flash, Renderer
8-
end
6+
include AbstractController::Callbacks, Session, Flash, Renderer
97

108
# This module provides a class-level method for specifying that certain
119
# actions are guarded against being called without certain prerequisites

actionpack/lib/action_controller/caching/actions.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ def caches_action(*actions)
6262

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

65-
# TODO: Remove this once new base is swapped in.
66-
if defined?(ActionController::Http)
67-
around_filter cache_filter, filter_options
68-
else
69-
around_filter(filter_options) do |controller, action|
70-
cache_filter.filter(controller, action)
71-
end
72-
end
65+
around_filter cache_filter, filter_options
7366
end
7467
end
7568

actionpack/test/abstract_unit.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
$:.unshift(File.dirname(__FILE__) + '/../lib')
22
$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
3+
$:.unshift(File.dirname(__FILE__) + '/../../activemodel/lib')
34
$:.unshift(File.dirname(__FILE__) + '/lib')
45

56
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')

actionpack/test/lib/controller/fake_models.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "active_model"
2+
13
class Customer < Struct.new(:name, :id)
24
extend ActiveModel::Naming
35

0 commit comments

Comments
 (0)