aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb10
-rw-r--r--actionpack/lib/action_dispatch/http/rack_cache.rb9
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb7
-rw-r--r--actionpack/lib/action_dispatch/middleware/cookies.rb14
-rw-r--r--actionpack/lib/action_dispatch/testing/performance_test.rb1
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb11
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb9
7 files changed, 22 insertions, 39 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 1c63fb2d14..475785a4b4 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -46,14 +46,14 @@ module AbstractController
@view_context_class ||= begin
controller = self
Class.new(ActionView::Base) do
+ if controller.respond_to?(:_routes) && controller._routes
+ include controller._routes.url_helpers
+ include controller._routes.mounted_helpers
+ end
+
if controller.respond_to?(:_helpers)
include controller._helpers
- if controller.respond_to?(:_routes) && controller._routes
- include controller._routes.url_helpers
- include controller._routes.mounted_helpers
- end
-
# TODO: Fix RJS to not require this
self.helpers = controller._helpers
end
diff --git a/actionpack/lib/action_dispatch/http/rack_cache.rb b/actionpack/lib/action_dispatch/http/rack_cache.rb
index e5914abc81..b5c1435903 100644
--- a/actionpack/lib/action_dispatch/http/rack_cache.rb
+++ b/actionpack/lib/action_dispatch/http/rack_cache.rb
@@ -21,11 +21,6 @@ module ActionDispatch
@store.write(key, value)
end
- def purge(key)
- @store.delete(key)
- nil
- end
-
::Rack::Cache::MetaStore::RAILS = self
end
@@ -58,10 +53,6 @@ module ActionDispatch
[key, size]
end
- def purge(key)
- @store.delete(key)
- end
-
::Rack::Cache::EntityStore::RAILS = self
end
end
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index cfee95eb4b..4da82f958a 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -8,11 +8,6 @@ module ActionDispatch
protocol + host_with_port + fullpath
end
- # Returns 'https' if this is an SSL request and 'http' otherwise.
- def scheme
- ssl? ? 'https' : 'http'
- end
-
# Returns 'https://' if this is an SSL request and 'http://' otherwise.
def protocol
@protocol ||= ssl? ? 'https://' : 'http://'
@@ -99,4 +94,4 @@ module ActionDispatch
end
end
end
-end \ No newline at end of file
+end
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb
index 75c8cc3dd0..c4c2e1acd7 100644
--- a/actionpack/lib/action_dispatch/middleware/cookies.rb
+++ b/actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -98,17 +98,19 @@ module ActionDispatch
def self.build(request)
secret = request.env[TOKEN_KEY]
host = request.host
+ secure = request.ssl?
- new(secret, host).tap do |hash|
+ new(secret, host, secure).tap do |hash|
hash.update(request.cookies)
end
end
- def initialize(secret = nil, host = nil)
+ def initialize(secret = nil, host = nil, secure = false)
@secret = secret
@set_cookies = {}
@delete_cookies = {}
@host = host
+ @secure = secure
super()
end
@@ -193,9 +195,15 @@ module ActionDispatch
end
def write(headers)
- @set_cookies.each { |k, v| ::Rack::Utils.set_cookie_header!(headers, k, v) }
+ @set_cookies.each { |k, v| ::Rack::Utils.set_cookie_header!(headers, k, v) if write_cookie?(v) }
@delete_cookies.each { |k, v| ::Rack::Utils.delete_cookie_header!(headers, k, v) }
end
+
+ private
+
+ def write_cookie?(cookie)
+ @secure || !cookie[:secure] || defined?(Rails.env) && Rails.env.development?
+ end
end
class PermanentCookieJar < CookieJar #:nodoc:
diff --git a/actionpack/lib/action_dispatch/testing/performance_test.rb b/actionpack/lib/action_dispatch/testing/performance_test.rb
index d6c98b4db7..e7aeb45fb3 100644
--- a/actionpack/lib/action_dispatch/testing/performance_test.rb
+++ b/actionpack/lib/action_dispatch/testing/performance_test.rb
@@ -1,5 +1,4 @@
require 'active_support/testing/performance'
-require 'active_support/testing/default'
begin
module ActionDispatch
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index 3aee4fb773..c1214bc44e 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -215,21 +215,10 @@ module ActionView
# # Creates a time select tag that, when POSTed, will be stored in the post variable in the sunrise attribute
# time_select("post", "sunrise")
#
- # # Creates a time select tag that, when POSTed, will be stored in the order variable in the submitted
- # # attribute
- # time_select("order", "submitted")
- #
- # # Creates a time select tag that, when POSTed, will be stored in the mail variable in the sent_at attribute
- # time_select("mail", "sent_at")
- #
# # Creates a time select tag with a seconds field that, when POSTed, will be stored in the post variables in
# # the sunrise attribute.
# time_select("post", "start_time", :include_seconds => true)
#
- # # Creates a time select tag with a seconds field that, when POSTed, will be stored in the entry variables in
- # # the submission_time attribute.
- # time_select("entry", "submission_time", :include_seconds => true)
- #
# # You can set the :minute_step to 15 which will give you: 00, 15, 30 and 45.
# time_select 'game', 'game_time', {:minute_step => 15}
#
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index 2f29c8f0e6..ee51617a2b 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -24,16 +24,17 @@ module ActionView
# escaping.
#
# ==== Options
+ # You can use symbols or strings for the attribute names.
+ #
# Use +true+ with boolean attributes that can render with no value, like
# +disabled+ and +readonly+.
#
# HTML5 <tt>data-*</tt> attributes can be set with a single +data+ key
# pointing to a hash of sub-attributes.
#
- # Sub-attribute keys may be strings or symbols. To play nicely with
- # JavaScript conventions +dataset+ they will be dasherized so that a key
- # +user_id+ would render as <tt>data-user-id</tt> and thus accessed as
- # <tt>dataset.userId</tt>.
+ # To play nicely with JavaScript conventions sub-attributes are dasherized.
+ # For example, a key +user_id+ would render as <tt>data-user-id</tt> and
+ # thus accessed as <tt>dataset.userId</tt>.
#
# Values are encoded to JSON, with the exception of strings and symbols.
# This may come in handy when using jQuery's HTML5-aware <tt>.data()<tt>