aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller.rb1
-rw-r--r--actionpack/lib/action_controller/base.rb2
-rw-r--r--actionpack/lib/action_controller/metal/asset_paths.rb13
-rw-r--r--actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb6
-rw-r--r--actionpack/lib/action_dispatch/request/session.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/lib/action_view.rb1
-rw-r--r--actionpack/lib/action_view/asset_paths.rb7
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb4
-rw-r--r--actionpack/lib/action_view/template/error.rb3
-rw-r--r--actionpack/test/dispatch/session/mem_cache_store_test.rb9
11 files changed, 22 insertions, 28 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb
index 0b96c96a2c..8c1f548e47 100644
--- a/actionpack/lib/action_controller.rb
+++ b/actionpack/lib/action_controller.rb
@@ -12,7 +12,6 @@ module ActionController
autoload :Middleware
autoload_under "metal" do
- autoload :AssetPaths
autoload :Compatibility
autoload :ConditionalGet
autoload :Cookies
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 0d79e046a1..f829f5e8a2 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -183,8 +183,8 @@ module ActionController
MODULES = [
AbstractController::Layouts,
AbstractController::Translation,
+ AbstractController::AssetPaths,
- AssetPaths,
Helpers,
HideActions,
UrlFor,
diff --git a/actionpack/lib/action_controller/metal/asset_paths.rb b/actionpack/lib/action_controller/metal/asset_paths.rb
deleted file mode 100644
index 3c1c95c042..0000000000
--- a/actionpack/lib/action_controller/metal/asset_paths.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'action_controller/metal/exceptions'
-
-module ActionController
- module AssetPaths
- extend ActiveSupport::Concern
-
- include AbstractController::AssetPaths
-
- def invalid_asset_host!(help_message)
- raise ActionController::RoutingError, "This asset host cannot be computed without a request in scope. #{help_message}"
- end
- end
-end
diff --git a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
index 14af7eef68..38a737cd2b 100644
--- a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
+++ b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
@@ -1,15 +1,15 @@
require 'action_dispatch/middleware/session/abstract_store'
-require 'rack/session/dalli'
+require 'rack/session/memcache'
module ActionDispatch
module Session
- class MemCacheStore < Rack::Session::Dalli
+ class MemCacheStore < Rack::Session::Memcache
include Compatibility
include StaleSessionCheck
include SessionObject
def initialize(app, options = {})
- require 'dalli'
+ require 'memcache'
options[:expire_after] ||= options[:expires]
super
end
diff --git a/actionpack/lib/action_dispatch/request/session.rb b/actionpack/lib/action_dispatch/request/session.rb
index e17f2a5de6..a05a23d953 100644
--- a/actionpack/lib/action_dispatch/request/session.rb
+++ b/actionpack/lib/action_dispatch/request/session.rb
@@ -2,7 +2,7 @@ require 'rack/session/abstract/id'
module ActionDispatch
class Request < Rack::Request
- # SessionHash is responsible to lazily load the session from store.
+ # Session is responsible for lazily loading the session from store.
class Session # :nodoc:
ENV_SESSION_KEY = Rack::Session::Abstract::ENV_SESSION_KEY # :nodoc:
ENV_SESSION_OPTIONS_KEY = Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY # :nodoc:
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index f64cff8394..b52f66faf1 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -757,7 +757,7 @@ module ActionDispatch
#
# Routes can also be constrained to an IP or a certain range of IP addresses:
#
- # constraints(:ip => /192.168.\d+.\d+/) do
+ # constraints(:ip => /192\.168\.\d+\.\d+/) do
# resources :posts
# end
#
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index 68a2322163..091b0d8cd2 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -71,6 +71,7 @@ module ActionView
autoload :MissingTemplate
autoload :ActionViewError
autoload :EncodingError
+ autoload :MissingRequestError
autoload :TemplateError
autoload :WrongEncodingError
end
diff --git a/actionpack/lib/action_view/asset_paths.rb b/actionpack/lib/action_view/asset_paths.rb
index 3ddd8bd552..4bbb31b3ee 100644
--- a/actionpack/lib/action_view/asset_paths.rb
+++ b/actionpack/lib/action_view/asset_paths.rb
@@ -1,6 +1,5 @@
require 'zlib'
require 'active_support/core_ext/file'
-require 'active_support/core_ext/module/delegation'
module ActionView
class AssetPaths #:nodoc:
@@ -8,8 +7,6 @@ module ActionView
attr_reader :config, :controller
- delegate :invalid_asset_host!, :to => :controller, :prefix => false
-
def initialize(config, controller = nil)
@config = config
@controller = controller
@@ -99,6 +96,10 @@ module ActionView
@config.default_asset_host_protocol || (has_request? ? :request : :relative)
end
+ def invalid_asset_host!(help_message)
+ raise ActionView::MissingRequestError, "This asset host cannot be computed without a request in scope. #{help_message}"
+ end
+
# Pick an asset host for this source. Returns +nil+ if no host is set,
# the host if no wildcard is set, the host interpolated with the
# numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4),
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index ace457df2e..f16e33d08d 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -117,6 +117,10 @@ module ActionView
# select_tag "destination", "<option>NYC</option><option>Paris</option><option>Rome</option>".html_safe, :disabled => true
# # => <select disabled="disabled" id="destination" name="destination"><option>NYC</option>
# # <option>Paris</option><option>Rome</option></select>
+ #
+ # select_tag "credit_card", options_for_select([ "VISA", "MasterCard" ], "MasterCard")
+ # # => <select id="credit_card" name="credit_card"><option>VISA</option>
+ # # <option selected="selected">MasterCard</option></select>
def select_tag(name, option_tags = nil, options = {})
option_tags ||= ""
html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index f2bef4bded..e00056781d 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -8,6 +8,9 @@ module ActionView
class EncodingError < StandardError #:nodoc:
end
+ class MissingRequestError < StandardError #:nodoc:
+ end
+
class WrongEncodingError < EncodingError #:nodoc:
def initialize(string, encoding)
@string, @encoding = string, encoding
diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb
index 0705fe3e7c..03234612ab 100644
--- a/actionpack/test/dispatch/session/mem_cache_store_test.rb
+++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb
@@ -1,5 +1,4 @@
require 'abstract_unit'
-require 'fixtures/session_autoload_test/session_autoload_test/foo'
# You need to start a memcached server inorder to run these tests
class MemCacheStoreTest < ActionDispatch::IntegrationTest
@@ -35,9 +34,9 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest
end
begin
- require 'dalli'
- ss = Dalli::Client.new('localhost:11211').stats
- raise Dalli::DalliError unless ss['localhost:11211']
+ require 'memcache'
+ memcache = MemCache.new('localhost:11211')
+ memcache.set('ping', '')
def test_setting_and_getting_session_value
with_test_route_set do
@@ -166,7 +165,7 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest
assert_not_equal session_id, cookies['_session_id']
end
end
- rescue LoadError, RuntimeError, Dalli::DalliError
+ rescue LoadError, RuntimeError
$stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again."
end