aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-17 16:14:05 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-17 16:14:05 -0700
commit8fdf3d7890d2e58508e028c93d3797f21a774dbc (patch)
tree4eff185e19bd63161ad15fb47120f53e93debcf5 /actionpack
parent251a6e492c72d8aea713b7dabd245d68301e455d (diff)
downloadrails-8fdf3d7890d2e58508e028c93d3797f21a774dbc.tar.gz
rails-8fdf3d7890d2e58508e028c93d3797f21a774dbc.tar.bz2
rails-8fdf3d7890d2e58508e028c93d3797f21a774dbc.zip
Remove some defined?(Http) checks
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/base/filter_parameter_logging.rb5
-rw-r--r--actionpack/lib/action_controller/base/flash.rb27
-rw-r--r--actionpack/lib/action_controller/base/mime_responds.rb5
-rw-r--r--actionpack/lib/action_controller/base/request_forgery_protection.rb18
-rw-r--r--actionpack/lib/action_controller/base/verification.rb4
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb9
-rw-r--r--actionpack/test/abstract_unit.rb1
-rw-r--r--actionpack/test/lib/controller/fake_models.rb2
8 files changed, 16 insertions, 55 deletions
diff --git a/actionpack/lib/action_controller/base/filter_parameter_logging.rb b/actionpack/lib/action_controller/base/filter_parameter_logging.rb
index 8370ba6fc0..26cd03f277 100644
--- a/actionpack/lib/action_controller/base/filter_parameter_logging.rb
+++ b/actionpack/lib/action_controller/base/filter_parameter_logging.rb
@@ -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
diff --git a/actionpack/lib/action_controller/base/flash.rb b/actionpack/lib/action_controller/base/flash.rb
index 42c6e430ca..cac14175d9 100644
--- a/actionpack/lib/action_controller/base/flash.rb
+++ b/actionpack/lib/action_controller/base/flash.rb
@@ -33,14 +33,7 @@ module ActionController #:nodoc:
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:
@@ -148,23 +141,7 @@ module ActionController #:nodoc:
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
diff --git a/actionpack/lib/action_controller/base/mime_responds.rb b/actionpack/lib/action_controller/base/mime_responds.rb
index c0aa58a6c2..ed0d58dba1 100644
--- a/actionpack/lib/action_controller/base/mime_responds.rb
+++ b/actionpack/lib/action_controller/base/mime_responds.rb
@@ -120,10 +120,7 @@ module ActionController #:nodoc:
@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]
diff --git a/actionpack/lib/action_controller/base/request_forgery_protection.rb b/actionpack/lib/action_controller/base/request_forgery_protection.rb
index a470c8eec1..6ba86cd0be 100644
--- a/actionpack/lib/action_controller/base/request_forgery_protection.rb
+++ b/actionpack/lib/action_controller/base/request_forgery_protection.rb
@@ -6,20 +6,16 @@ module ActionController #:nodoc:
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?
diff --git a/actionpack/lib/action_controller/base/verification.rb b/actionpack/lib/action_controller/base/verification.rb
index d87b348ed4..7190b6b106 100644
--- a/actionpack/lib/action_controller/base/verification.rb
+++ b/actionpack/lib/action_controller/base/verification.rb
@@ -3,9 +3,7 @@ module ActionController #: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
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index 54148b55d8..4420678df6 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -62,14 +62,7 @@ module ActionController #:nodoc:
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
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 1333a9d71a..30e795a7a2 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -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')
diff --git a/actionpack/test/lib/controller/fake_models.rb b/actionpack/test/lib/controller/fake_models.rb
index 5e63204bad..9e6f14d373 100644
--- a/actionpack/test/lib/controller/fake_models.rb
+++ b/actionpack/test/lib/controller/fake_models.rb
@@ -1,3 +1,5 @@
+require "active_model"
+
class Customer < Struct.new(:name, :id)
extend ActiveModel::Naming