actionpack 4.0.5 → 4.0.6.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/CHANGELOG.md +69 -0
- data/lib/action_controller/metal.rb +4 -0
- data/lib/action_controller/metal/head.rb +1 -1
- data/lib/action_controller/metal/http_authentication.rb +1 -1
- data/lib/action_controller/metal/rack_delegation.rb +1 -1
- data/lib/action_controller/metal/strong_parameters.rb +1 -1
- data/lib/action_dispatch/http/headers.rb +3 -1
- data/lib/action_dispatch/http/mime_negotiation.rb +1 -1
- data/lib/action_dispatch/http/mime_type.rb +1 -1
- data/lib/action_dispatch/http/response.rb +3 -0
- data/lib/action_dispatch/http/url.rb +18 -10
- data/lib/action_dispatch/middleware/session/cookie_store.rb +1 -1
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +1 -1
- data/lib/action_dispatch/routing.rb +1 -0
- data/lib/action_dispatch/routing/mapper.rb +57 -23
- data/lib/action_dispatch/routing/route_set.rb +2 -0
- data/lib/action_dispatch/testing/assertions/selector.rb +4 -4
- data/lib/action_pack/version.rb +1 -1
- data/lib/action_view/helpers/asset_url_helper.rb +2 -2
- data/lib/action_view/helpers/date_helper.rb +1 -1
- data/lib/action_view/helpers/form_options_helper.rb +2 -2
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +13 -4
- data/lib/action_view/template/resolver.rb +21 -7
- metadata +40 -56
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a7460c198d53a6224fd45b3e728bbb02bd6dd659
|
4
|
+
data.tar.gz: cd164c83bad33bead0df3e375e760fe0df9bece3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: efa463a86ec187cd62303f6d09132fc9e5aa8d937e8db6c2428e1303e7f25d0fa5fb5bc28949656e66c780bfb8a207b1df37fc784491bac9c83491a54bf024d2
|
7
|
+
data.tar.gz: 66a71d0390f4d411c229a767a4a8475890f76f7b969bc6d73a3c6ba96b30fd746e2d4192bf49a6008cd48c0aab3952a3a025ec50dac38525045207ff6b3c39ba
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,72 @@
|
|
1
|
+
## Rails 4.0.6 (May 27, 2014) ##
|
2
|
+
|
3
|
+
* Fix URL generation with `:trailing_slash` such that it does not add
|
4
|
+
a trailing slash after `.:format`
|
5
|
+
|
6
|
+
*Dan Langevin*
|
7
|
+
|
8
|
+
* Fix `'Stack level too deep'` when rendering `head :ok` in an action method
|
9
|
+
called 'status' in a controller.
|
10
|
+
|
11
|
+
Fixes #13905.
|
12
|
+
|
13
|
+
*Christiaan Van den Poel*
|
14
|
+
|
15
|
+
* Always use the provided port if the protocol is relative.
|
16
|
+
|
17
|
+
Fixes #15043.
|
18
|
+
|
19
|
+
*Guilherme Cavalcanti*, *Andrew White*
|
20
|
+
|
21
|
+
* Change `asset_path` to use File.join to create proper paths.
|
22
|
+
|
23
|
+
https://some.host.com//assets/some.js
|
24
|
+
|
25
|
+
becomes
|
26
|
+
|
27
|
+
https://some.host.com/assets/some.js
|
28
|
+
|
29
|
+
*Peter Schröder*
|
30
|
+
|
31
|
+
* Returns null type format when format is not know and controller is using `any`
|
32
|
+
format block.
|
33
|
+
|
34
|
+
Fixes #14462.
|
35
|
+
|
36
|
+
*Rafael Mendonça França*
|
37
|
+
|
38
|
+
* `collection_check_boxes` respects `:index` option for the hidden filed name.
|
39
|
+
|
40
|
+
Fixes #14147.
|
41
|
+
|
42
|
+
*Vasiliy Ermolovich*
|
43
|
+
|
44
|
+
* Only make deeply nested routes shallow when parent is shallow.
|
45
|
+
|
46
|
+
Fixes #14684.
|
47
|
+
|
48
|
+
*Andrew White*, *James Coglan*
|
49
|
+
|
50
|
+
* `date_select` helper with option `with_css_classes: true` does not overwrite other classes.
|
51
|
+
|
52
|
+
*Izumi Wong-Horiuchi*
|
53
|
+
|
54
|
+
* Swapped the parameters of `assert_equal` in `assert_select` so that the
|
55
|
+
proper values were printed correctly.
|
56
|
+
|
57
|
+
Fixes #14422.
|
58
|
+
|
59
|
+
*Vishal Lal*
|
60
|
+
|
61
|
+
* The method `shallow?` returns false if the parent resource is a singleton so
|
62
|
+
we need to check if we're not inside a nested scope before copying the `:path`
|
63
|
+
and `:as` options to their shallow equivalents.
|
64
|
+
|
65
|
+
Fixes #14388.
|
66
|
+
|
67
|
+
*Andrew White*
|
68
|
+
|
69
|
+
|
1
70
|
## Rails 4.0.5 (May 6, 2014) ##
|
2
71
|
|
3
72
|
* Only accept actions without File::SEPARATOR in the name.
|
@@ -29,7 +29,7 @@ module ActionController
|
|
29
29
|
self.status = status
|
30
30
|
self.location = url_for(location) if location
|
31
31
|
|
32
|
-
if include_content?(self.
|
32
|
+
if include_content?(self._status_code)
|
33
33
|
self.content_type = content_type || (Mime[formats.first] if formats)
|
34
34
|
self.response.charset = false if self.response
|
35
35
|
self.response_body = " "
|
@@ -6,7 +6,7 @@ module ActionController
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
delegate :headers, :status=, :location=, :content_type=,
|
9
|
-
:status, :location, :content_type, :to => "@_response"
|
9
|
+
:status, :location, :content_type, :_status_code, :to => "@_response"
|
10
10
|
|
11
11
|
def dispatch(action, request)
|
12
12
|
set_response!(request)
|
@@ -497,7 +497,7 @@ module ActionController
|
|
497
497
|
# end
|
498
498
|
# end
|
499
499
|
#
|
500
|
-
# In order to use <tt>
|
500
|
+
# In order to use <tt>accepts_nested_attributes_for</tt> with Strong \Parameters, you
|
501
501
|
# will need to specify which nested attributes should be whitelisted.
|
502
502
|
#
|
503
503
|
# class Person
|
@@ -178,7 +178,7 @@ module Mime
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def parse(accept_header)
|
181
|
-
if accept_header
|
181
|
+
if !accept_header.include?(',')
|
182
182
|
accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first
|
183
183
|
parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact
|
184
184
|
else
|
@@ -34,19 +34,15 @@ module ActionDispatch
|
|
34
34
|
path = options.delete(:script_name).to_s.chomp("/")
|
35
35
|
path << options.delete(:path).to_s
|
36
36
|
|
37
|
+
add_trailing_slash(path) if options[:trailing_slash]
|
38
|
+
|
37
39
|
params = options[:params].is_a?(Hash) ? options[:params] : options.slice(:params)
|
38
40
|
params.reject! { |_,v| v.to_param.nil? }
|
39
41
|
|
40
42
|
result = build_host_url(options)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
else
|
45
|
-
result << path.sub(/[^\/]\z|\A\z/, '\&/')
|
46
|
-
end
|
47
|
-
else
|
48
|
-
result << path
|
49
|
-
end
|
43
|
+
|
44
|
+
result << path
|
45
|
+
|
50
46
|
result << "?#{params.to_query}" unless params.empty?
|
51
47
|
result << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor]
|
52
48
|
result
|
@@ -54,6 +50,18 @@ module ActionDispatch
|
|
54
50
|
|
55
51
|
private
|
56
52
|
|
53
|
+
def add_trailing_slash(path)
|
54
|
+
# includes querysting
|
55
|
+
if path.include?('?')
|
56
|
+
path.sub!(/\?/, '/\&')
|
57
|
+
# does not have a .format
|
58
|
+
elsif !path.include?(".")
|
59
|
+
path.sub!(/[^\/]\z|\A\z/, '\&/')
|
60
|
+
end
|
61
|
+
|
62
|
+
path
|
63
|
+
end
|
64
|
+
|
57
65
|
def build_host_url(options)
|
58
66
|
if options[:host].blank? && options[:only_path].blank?
|
59
67
|
raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true'
|
@@ -130,7 +138,7 @@ module ActionDispatch
|
|
130
138
|
|
131
139
|
case options[:protocol]
|
132
140
|
when "//"
|
133
|
-
|
141
|
+
options[:port]
|
134
142
|
when "https://"
|
135
143
|
options[:port].to_i == 443 ? nil : options[:port]
|
136
144
|
else
|
@@ -50,7 +50,7 @@ module ActionDispatch
|
|
50
50
|
# decode signed cookies generated by your app in external applications or
|
51
51
|
# Javascript before upgrading.
|
52
52
|
#
|
53
|
-
# Note that changing
|
53
|
+
# Note that changing the secret key will invalidate all existing sessions!
|
54
54
|
class CookieStore < Rack::Session::Abstract::ID
|
55
55
|
include Compatibility
|
56
56
|
include StaleSessionCheck
|
@@ -122,7 +122,7 @@
|
|
122
122
|
// On key press perform a search for matching paths
|
123
123
|
pathElem.onkeyup = function(e){
|
124
124
|
var path = sanitizePath(pathElem.value),
|
125
|
-
defaultText = '<tr><th colspan="4">Paths Matching (' + path + '):</th></tr>';
|
125
|
+
defaultText = '<tr><th colspan="4">Paths Matching (' + escape(path) + '):</th></tr>';
|
126
126
|
|
127
127
|
// Clear out results section
|
128
128
|
selectedSection.innerHTML= defaultText;
|
@@ -332,18 +332,35 @@ module ActionDispatch
|
|
332
332
|
match '/', { :as => :root, :via => :get }.merge!(options)
|
333
333
|
end
|
334
334
|
|
335
|
-
# Matches a url pattern to one or more routes.
|
336
|
-
# are interpreted as url query parameters and thus available as +params+
|
337
|
-
# in an action:
|
335
|
+
# Matches a url pattern to one or more routes.
|
338
336
|
#
|
337
|
+
# You should not use the `match` method in your router
|
338
|
+
# without specifying an HTTP method.
|
339
|
+
#
|
340
|
+
# If you want to expose your action to both GET and POST, use:
|
341
|
+
#
|
339
342
|
# # sets :controller, :action and :id in params
|
340
|
-
# match ':controller/:action/:id'
|
343
|
+
# match ':controller/:action/:id', via: [:get, :post]
|
344
|
+
#
|
345
|
+
# Note that +:controller+, +:action+, +:id+ are interpreted as url query
|
346
|
+
# parameters and thus available as +params+
|
347
|
+
# in an action.
|
348
|
+
#
|
349
|
+
# If you want to expose your action to GET, use `get` in the router:
|
350
|
+
#
|
351
|
+
# Instead of:
|
352
|
+
#
|
353
|
+
# match ":controller/:action/:id"
|
354
|
+
#
|
355
|
+
# Do:
|
356
|
+
#
|
357
|
+
# get ":controller/:action/:id"
|
341
358
|
#
|
342
359
|
# Two of these symbols are special, +:controller+ maps to the controller
|
343
360
|
# and +:action+ to the controller's action. A pattern can also map
|
344
361
|
# wildcard segments (globs) to params:
|
345
362
|
#
|
346
|
-
#
|
363
|
+
# get 'songs/*category/:title', to: 'songs#show'
|
347
364
|
#
|
348
365
|
# # 'songs/rock/classic/stairway-to-heaven' sets
|
349
366
|
# # params[:category] = 'rock/classic'
|
@@ -352,17 +369,17 @@ module ActionDispatch
|
|
352
369
|
# When a pattern points to an internal route, the route's +:action+ and
|
353
370
|
# +:controller+ should be set in options or hash shorthand. Examples:
|
354
371
|
#
|
355
|
-
# match 'photos/:id' => 'photos#show'
|
356
|
-
# match 'photos/:id', to: 'photos#show'
|
357
|
-
# match 'photos/:id', controller: 'photos', action: 'show'
|
372
|
+
# match 'photos/:id' => 'photos#show', via: [:get]
|
373
|
+
# match 'photos/:id', to: 'photos#show', via: [:get]
|
374
|
+
# match 'photos/:id', controller: 'photos', action: 'show', via: [:get]
|
358
375
|
#
|
359
376
|
# A pattern can also point to a +Rack+ endpoint i.e. anything that
|
360
377
|
# responds to +call+:
|
361
378
|
#
|
362
|
-
# match 'photos/:id', to: lambda {|hash| [200, {}, ["Coming soon"]] }
|
363
|
-
# match 'photos/:id', to: PhotoRackApp
|
379
|
+
# match 'photos/:id', to: lambda {|hash| [200, {}, ["Coming soon"]] }, via: [:get]
|
380
|
+
# match 'photos/:id', to: PhotoRackApp, via: [:get]
|
364
381
|
# # Yes, controller actions are just rack endpoints
|
365
|
-
# match 'photos/:id', to: PhotosController.action(:show)
|
382
|
+
# match 'photos/:id', to: PhotosController.action(:show), via: [:get]
|
366
383
|
#
|
367
384
|
# Because request various HTTP verbs with a single action has security
|
368
385
|
# implications, is recommendable use HttpHelpers[rdoc-ref:HttpHelpers]
|
@@ -384,8 +401,8 @@ module ActionDispatch
|
|
384
401
|
# [:module]
|
385
402
|
# The namespace for :controller.
|
386
403
|
#
|
387
|
-
# match 'path', to: 'c#a', module: 'sekret', controller: 'posts'
|
388
|
-
#
|
404
|
+
# match 'path', to: 'c#a', module: 'sekret', controller: 'posts', via: [:get]
|
405
|
+
# # => Sekret::PostsController
|
389
406
|
#
|
390
407
|
# See <tt>Scoping#namespace</tt> for its scope equivalent.
|
391
408
|
#
|
@@ -403,9 +420,9 @@ module ActionDispatch
|
|
403
420
|
# Points to a +Rack+ endpoint. Can be an object that responds to
|
404
421
|
# +call+ or a string representing a controller's action.
|
405
422
|
#
|
406
|
-
# match 'path', to: 'controller#action'
|
407
|
-
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }
|
408
|
-
# match 'path', to: RackApp
|
423
|
+
# match 'path', to: 'controller#action', via: [:get]
|
424
|
+
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }, via: [:get]
|
425
|
+
# match 'path', to: RackApp, via: [:get]
|
409
426
|
#
|
410
427
|
# [:on]
|
411
428
|
# Shorthand for wrapping routes in a specific RESTful context. Valid
|
@@ -430,14 +447,14 @@ module ActionDispatch
|
|
430
447
|
# other than path can also be specified with any object
|
431
448
|
# that responds to <tt>===</tt> (eg. String, Array, Range, etc.).
|
432
449
|
#
|
433
|
-
# match 'path/:id', constraints: { id: /[A-Z]\d{5}/ }
|
450
|
+
# match 'path/:id', constraints: { id: /[A-Z]\d{5}/ }, via: [:get]
|
434
451
|
#
|
435
|
-
# match 'json_only', constraints: { format: 'json' }
|
452
|
+
# match 'json_only', constraints: { format: 'json' }, via: [:get]
|
436
453
|
#
|
437
454
|
# class Blacklist
|
438
455
|
# def matches?(request) request.remote_ip == '1.2.3.4' end
|
439
456
|
# end
|
440
|
-
# match 'path', to: 'c#a', constraints: Blacklist.new
|
457
|
+
# match 'path', to: 'c#a', constraints: Blacklist.new, via: [:get]
|
441
458
|
#
|
442
459
|
# See <tt>Scoping#constraints</tt> for more examples with its scope
|
443
460
|
# equivalent.
|
@@ -446,7 +463,7 @@ module ActionDispatch
|
|
446
463
|
# Sets defaults for parameters
|
447
464
|
#
|
448
465
|
# # Sets params[:format] to 'jpg' by default
|
449
|
-
# match 'path', to: 'c#a', defaults: { format: 'jpg' }
|
466
|
+
# match 'path', to: 'c#a', defaults: { format: 'jpg' }, via: [:get]
|
450
467
|
#
|
451
468
|
# See <tt>Scoping#defaults</tt> for its scope equivalent.
|
452
469
|
#
|
@@ -455,7 +472,7 @@ module ActionDispatch
|
|
455
472
|
# false, the pattern matches any request prefixed with the given path.
|
456
473
|
#
|
457
474
|
# # Matches any request starting with 'path'
|
458
|
-
# match 'path', to: 'c#a', anchor: false
|
475
|
+
# match 'path', to: 'c#a', anchor: false, via: [:get]
|
459
476
|
#
|
460
477
|
# [:format]
|
461
478
|
# Allows you to specify the default value for optional +format+
|
@@ -697,7 +714,7 @@ module ActionDispatch
|
|
697
714
|
options[:path] = args.flatten.join('/') if args.any?
|
698
715
|
options[:constraints] ||= {}
|
699
716
|
|
700
|
-
unless
|
717
|
+
unless nested_scope?
|
701
718
|
options[:shallow_path] ||= options[:path] if options.key?(:path)
|
702
719
|
options[:shallow_prefix] ||= options[:as] if options.key?(:as)
|
703
720
|
end
|
@@ -981,6 +998,7 @@ module ActionDispatch
|
|
981
998
|
@as = options[:as]
|
982
999
|
@param = (options[:param] || :id).to_sym
|
983
1000
|
@options = options
|
1001
|
+
@shallow = false
|
984
1002
|
end
|
985
1003
|
|
986
1004
|
def default_actions
|
@@ -1041,6 +1059,13 @@ module ActionDispatch
|
|
1041
1059
|
"#{path}/:#{nested_param}"
|
1042
1060
|
end
|
1043
1061
|
|
1062
|
+
def shallow=(value)
|
1063
|
+
@shallow = value
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
def shallow?
|
1067
|
+
@shallow
|
1068
|
+
end
|
1044
1069
|
end
|
1045
1070
|
|
1046
1071
|
class SingletonResource < Resource #:nodoc:
|
@@ -1347,7 +1372,7 @@ module ActionDispatch
|
|
1347
1372
|
end
|
1348
1373
|
|
1349
1374
|
with_scope_level(:nested) do
|
1350
|
-
if shallow? &&
|
1375
|
+
if shallow? && shallow_nesting_depth > 1
|
1351
1376
|
shallow_scope(parent_resource.nested_scope, nested_options) { yield }
|
1352
1377
|
else
|
1353
1378
|
scope(parent_resource.nested_scope, nested_options) { yield }
|
@@ -1536,6 +1561,10 @@ module ActionDispatch
|
|
1536
1561
|
RESOURCE_METHOD_SCOPES.include? @scope[:scope_level]
|
1537
1562
|
end
|
1538
1563
|
|
1564
|
+
def nested_scope? #:nodoc:
|
1565
|
+
@scope[:scope_level] == :nested
|
1566
|
+
end
|
1567
|
+
|
1539
1568
|
def with_exclusive_scope
|
1540
1569
|
begin
|
1541
1570
|
old_name_prefix, old_path = @scope[:as], @scope[:path]
|
@@ -1557,6 +1586,7 @@ module ActionDispatch
|
|
1557
1586
|
end
|
1558
1587
|
|
1559
1588
|
def resource_scope(kind, resource) #:nodoc:
|
1589
|
+
resource.shallow = @scope[:shallow]
|
1560
1590
|
old_resource, @scope[:scope_level_resource] = @scope[:scope_level_resource], resource
|
1561
1591
|
@nesting.push(resource)
|
1562
1592
|
|
@@ -1581,6 +1611,10 @@ module ActionDispatch
|
|
1581
1611
|
@nesting.size
|
1582
1612
|
end
|
1583
1613
|
|
1614
|
+
def shallow_nesting_depth #:nodoc:
|
1615
|
+
@nesting.select(&:shallow?).size
|
1616
|
+
end
|
1617
|
+
|
1584
1618
|
def param_constraint? #:nodoc:
|
1585
1619
|
@scope[:constraints] && @scope[:constraints][parent_resource.param].is_a?(Regexp)
|
1586
1620
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'action_dispatch/journey'
|
2
2
|
require 'forwardable'
|
3
3
|
require 'thread_safe'
|
4
|
+
require 'active_support/concern'
|
4
5
|
require 'active_support/core_ext/object/to_query'
|
5
6
|
require 'active_support/core_ext/hash/slice'
|
6
7
|
require 'active_support/core_ext/module/remove_method'
|
7
8
|
require 'active_support/core_ext/array/extract_options'
|
8
9
|
require 'action_controller/metal/exceptions'
|
10
|
+
require 'action_dispatch/http/request'
|
9
11
|
|
10
12
|
module ActionDispatch
|
11
13
|
module Routing
|
@@ -267,7 +267,7 @@ module ActionDispatch
|
|
267
267
|
text.strip! unless NO_STRIP.include?(match.name)
|
268
268
|
text.sub!(/\A\n/, '') if match.name == "textarea"
|
269
269
|
unless match_with.is_a?(Regexp) ? (text =~ match_with) : (text == match_with.to_s)
|
270
|
-
content_mismatch ||= sprintf("<%s> expected but was\n<%s
|
270
|
+
content_mismatch ||= sprintf("<%s> expected but was\n<%s>", match_with, text)
|
271
271
|
true
|
272
272
|
end
|
273
273
|
end
|
@@ -276,7 +276,7 @@ module ActionDispatch
|
|
276
276
|
html = match.children.map(&:to_s).join
|
277
277
|
html.strip! unless NO_STRIP.include?(match.name)
|
278
278
|
unless match_with.is_a?(Regexp) ? (html =~ match_with) : (html == match_with.to_s)
|
279
|
-
content_mismatch ||= sprintf("<%s> expected but was\n<%s
|
279
|
+
content_mismatch ||= sprintf("<%s> expected but was\n<%s>", match_with, html)
|
280
280
|
true
|
281
281
|
end
|
282
282
|
end
|
@@ -289,9 +289,9 @@ module ActionDispatch
|
|
289
289
|
|
290
290
|
# FIXME: minitest provides messaging when we use assert_operator,
|
291
291
|
# so is this custom message really needed?
|
292
|
-
message = message || %(Expected #{count_description(min, max, count)} matching "#{selector.to_s}", found #{matches.size}
|
292
|
+
message = message || %(Expected #{count_description(min, max, count)} matching "#{selector.to_s}", found #{matches.size})
|
293
293
|
if count
|
294
|
-
assert_equal matches.size,
|
294
|
+
assert_equal count, matches.size, message
|
295
295
|
else
|
296
296
|
assert_operator matches.size, :>=, min, message if min
|
297
297
|
assert_operator matches.size, :<=, max, message if max
|
data/lib/action_pack/version.rb
CHANGED
@@ -134,11 +134,11 @@ module ActionView
|
|
134
134
|
|
135
135
|
relative_url_root = defined?(config.relative_url_root) && config.relative_url_root
|
136
136
|
if relative_url_root
|
137
|
-
source =
|
137
|
+
source = File.join(relative_url_root, source) unless source.starts_with?("#{relative_url_root}/")
|
138
138
|
end
|
139
139
|
|
140
140
|
if host = compute_asset_host(source, options)
|
141
|
-
source =
|
141
|
+
source = File.join(host, source)
|
142
142
|
end
|
143
143
|
|
144
144
|
"#{source}#{tail}"
|
@@ -954,7 +954,7 @@ module ActionView
|
|
954
954
|
:name => input_name_from_type(type)
|
955
955
|
}.merge!(@html_options)
|
956
956
|
select_options[:disabled] = 'disabled' if @options[:disabled]
|
957
|
-
select_options[:class] = type if @options[:with_css_classes]
|
957
|
+
select_options[:class] = [select_options[:class], type].compact.join(' ') if @options[:with_css_classes]
|
958
958
|
|
959
959
|
select_html = "\n"
|
960
960
|
select_html << content_tag(:option, '', :value => '') + "\n" if @options[:include_blank]
|
@@ -351,8 +351,8 @@ module ActionView
|
|
351
351
|
html_attributes = option_html_attributes(element)
|
352
352
|
text, value = option_text_and_value(element).map { |item| item.to_s }
|
353
353
|
|
354
|
-
html_attributes[:selected]
|
355
|
-
html_attributes[:disabled]
|
354
|
+
html_attributes[:selected] ||= 'selected' if option_value_selected?(value, selected)
|
355
|
+
html_attributes[:disabled] ||= 'disabled' if disabled && option_value_selected?(value, disabled)
|
356
356
|
html_attributes[:value] = value
|
357
357
|
|
358
358
|
content_tag_string(:option, text, html_attributes)
|
@@ -27,10 +27,7 @@ module ActionView
|
|
27
27
|
|
28
28
|
# Append a hidden field to make sure something will be sent back to the
|
29
29
|
# server if all check boxes are unchecked.
|
30
|
-
|
31
|
-
hidden = @template_object.hidden_field_tag(hidden_name, "", :id => nil)
|
32
|
-
|
33
|
-
rendered_collection + hidden
|
30
|
+
rendered_collection + hidden_field
|
34
31
|
end
|
35
32
|
|
36
33
|
private
|
@@ -38,6 +35,18 @@ module ActionView
|
|
38
35
|
def render_component(builder)
|
39
36
|
builder.check_box + builder.label
|
40
37
|
end
|
38
|
+
|
39
|
+
def hidden_field
|
40
|
+
hidden_name = @html_options[:name]
|
41
|
+
|
42
|
+
hidden_name ||= if @options.has_key?(:index)
|
43
|
+
"#{tag_name_with_index(@options[:index])}[]"
|
44
|
+
else
|
45
|
+
"#{tag_name}[]"
|
46
|
+
end
|
47
|
+
|
48
|
+
@template_object.hidden_field_tag(hidden_name, "", id: nil)
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -180,13 +180,7 @@ module ActionView
|
|
180
180
|
def query(path, details, formats)
|
181
181
|
query = build_query(path, details)
|
182
182
|
|
183
|
-
|
184
|
-
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
|
185
|
-
|
186
|
-
template_paths = Dir[query].reject { |filename|
|
187
|
-
File.directory?(filename) ||
|
188
|
-
!sanitizer[File.dirname(filename)].include?(filename)
|
189
|
-
}
|
183
|
+
template_paths = find_template_paths query
|
190
184
|
|
191
185
|
template_paths.map { |template|
|
192
186
|
handler, format = extract_handler_and_format(template, formats)
|
@@ -199,6 +193,26 @@ module ActionView
|
|
199
193
|
}
|
200
194
|
end
|
201
195
|
|
196
|
+
if RUBY_VERSION >= '2.2.0'
|
197
|
+
def find_template_paths(query)
|
198
|
+
Dir[query].reject { |filename|
|
199
|
+
File.directory?(filename) ||
|
200
|
+
# deals with case-insensitive file systems.
|
201
|
+
!File.fnmatch(query, filename, File::FNM_EXTGLOB)
|
202
|
+
}
|
203
|
+
end
|
204
|
+
else
|
205
|
+
def find_template_paths(query)
|
206
|
+
# deals with case-insensitive file systems.
|
207
|
+
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
|
208
|
+
|
209
|
+
Dir[query].reject { |filename|
|
210
|
+
File.directory?(filename) ||
|
211
|
+
!sanitizer[File.dirname(filename)].include?(filename)
|
212
|
+
}
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
202
216
|
# Helper for building query glob string based on resolver's pattern.
|
203
217
|
def build_query(path, details)
|
204
218
|
query = @pattern.dup
|
metadata
CHANGED
@@ -1,126 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.6.rc1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Heinemeier Hansson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.0.
|
19
|
+
version: 4.0.6.rc1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 4.0.
|
26
|
+
version: 4.0.6.rc1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: builder
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.1.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.1.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rack
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.5.2
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.5.2
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rack-test
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 0.6.2
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 0.6.2
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: erubis
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- - ~>
|
73
|
+
- - "~>"
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 2.7.0
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- - ~>
|
80
|
+
- - "~>"
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 2.7.0
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: activemodel
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - '='
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version: 4.0.
|
89
|
+
version: 4.0.6.rc1
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - '='
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version: 4.0.
|
96
|
+
version: 4.0.6.rc1
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: tzinfo
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- - ~>
|
101
|
+
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 0.3.37
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- - ~>
|
108
|
+
- - "~>"
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: 0.3.37
|
126
111
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
@@ -131,8 +116,9 @@ extensions: []
|
|
131
116
|
extra_rdoc_files: []
|
132
117
|
files:
|
133
118
|
- CHANGELOG.md
|
134
|
-
- README.rdoc
|
135
119
|
- MIT-LICENSE
|
120
|
+
- README.rdoc
|
121
|
+
- lib/abstract_controller.rb
|
136
122
|
- lib/abstract_controller/asset_paths.rb
|
137
123
|
- lib/abstract_controller/base.rb
|
138
124
|
- lib/abstract_controller/callbacks.rb
|
@@ -145,13 +131,14 @@ files:
|
|
145
131
|
- lib/abstract_controller/translation.rb
|
146
132
|
- lib/abstract_controller/url_for.rb
|
147
133
|
- lib/abstract_controller/view_paths.rb
|
148
|
-
- lib/
|
134
|
+
- lib/action_controller.rb
|
149
135
|
- lib/action_controller/base.rb
|
150
|
-
- lib/action_controller/caching/fragments.rb
|
151
136
|
- lib/action_controller/caching.rb
|
152
|
-
- lib/action_controller/
|
137
|
+
- lib/action_controller/caching/fragments.rb
|
153
138
|
- lib/action_controller/deprecated.rb
|
139
|
+
- lib/action_controller/deprecated/integration_test.rb
|
154
140
|
- lib/action_controller/log_subscriber.rb
|
141
|
+
- lib/action_controller/metal.rb
|
155
142
|
- lib/action_controller/metal/conditional_get.rb
|
156
143
|
- lib/action_controller/metal/cookies.rb
|
157
144
|
- lib/action_controller/metal/data_streaming.rb
|
@@ -178,7 +165,6 @@ files:
|
|
178
165
|
- lib/action_controller/metal/strong_parameters.rb
|
179
166
|
- lib/action_controller/metal/testing.rb
|
180
167
|
- lib/action_controller/metal/url_for.rb
|
181
|
-
- lib/action_controller/metal.rb
|
182
168
|
- lib/action_controller/middleware.rb
|
183
169
|
- lib/action_controller/model_naming.rb
|
184
170
|
- lib/action_controller/railtie.rb
|
@@ -186,7 +172,7 @@ files:
|
|
186
172
|
- lib/action_controller/record_identifier.rb
|
187
173
|
- lib/action_controller/test_case.rb
|
188
174
|
- lib/action_controller/vendor/html-scanner.rb
|
189
|
-
- lib/
|
175
|
+
- lib/action_dispatch.rb
|
190
176
|
- lib/action_dispatch/http/cache.rb
|
191
177
|
- lib/action_dispatch/http/filter_parameters.rb
|
192
178
|
- lib/action_dispatch/http/filter_redirect.rb
|
@@ -201,6 +187,7 @@ files:
|
|
201
187
|
- lib/action_dispatch/http/response.rb
|
202
188
|
- lib/action_dispatch/http/upload.rb
|
203
189
|
- lib/action_dispatch/http/url.rb
|
190
|
+
- lib/action_dispatch/journey.rb
|
204
191
|
- lib/action_dispatch/journey/backwards.rb
|
205
192
|
- lib/action_dispatch/journey/formatter.rb
|
206
193
|
- lib/action_dispatch/journey/gtg/builder.rb
|
@@ -216,16 +203,15 @@ files:
|
|
216
203
|
- lib/action_dispatch/journey/parser_extras.rb
|
217
204
|
- lib/action_dispatch/journey/path/pattern.rb
|
218
205
|
- lib/action_dispatch/journey/route.rb
|
206
|
+
- lib/action_dispatch/journey/router.rb
|
219
207
|
- lib/action_dispatch/journey/router/strexp.rb
|
220
208
|
- lib/action_dispatch/journey/router/utils.rb
|
221
|
-
- lib/action_dispatch/journey/router.rb
|
222
209
|
- lib/action_dispatch/journey/routes.rb
|
223
210
|
- lib/action_dispatch/journey/scanner.rb
|
224
211
|
- lib/action_dispatch/journey/visitors.rb
|
225
212
|
- lib/action_dispatch/journey/visualizer/fsm.css
|
226
213
|
- lib/action_dispatch/journey/visualizer/fsm.js
|
227
214
|
- lib/action_dispatch/journey/visualizer/index.html.erb
|
228
|
-
- lib/action_dispatch/journey.rb
|
229
215
|
- lib/action_dispatch/middleware/callbacks.rb
|
230
216
|
- lib/action_dispatch/middleware/cookies.rb
|
231
217
|
- lib/action_dispatch/middleware/debug_exceptions.rb
|
@@ -257,6 +243,7 @@ files:
|
|
257
243
|
- lib/action_dispatch/middleware/templates/routes/_table.html.erb
|
258
244
|
- lib/action_dispatch/railtie.rb
|
259
245
|
- lib/action_dispatch/request/session.rb
|
246
|
+
- lib/action_dispatch/routing.rb
|
260
247
|
- lib/action_dispatch/routing/inspector.rb
|
261
248
|
- lib/action_dispatch/routing/mapper.rb
|
262
249
|
- lib/action_dispatch/routing/polymorphic_routes.rb
|
@@ -264,26 +251,26 @@ files:
|
|
264
251
|
- lib/action_dispatch/routing/route_set.rb
|
265
252
|
- lib/action_dispatch/routing/routes_proxy.rb
|
266
253
|
- lib/action_dispatch/routing/url_for.rb
|
267
|
-
- lib/action_dispatch/
|
254
|
+
- lib/action_dispatch/testing/assertions.rb
|
268
255
|
- lib/action_dispatch/testing/assertions/dom.rb
|
269
256
|
- lib/action_dispatch/testing/assertions/response.rb
|
270
257
|
- lib/action_dispatch/testing/assertions/routing.rb
|
271
258
|
- lib/action_dispatch/testing/assertions/selector.rb
|
272
259
|
- lib/action_dispatch/testing/assertions/tag.rb
|
273
|
-
- lib/action_dispatch/testing/assertions.rb
|
274
260
|
- lib/action_dispatch/testing/integration.rb
|
275
261
|
- lib/action_dispatch/testing/test_process.rb
|
276
262
|
- lib/action_dispatch/testing/test_request.rb
|
277
263
|
- lib/action_dispatch/testing/test_response.rb
|
278
|
-
- lib/action_dispatch.rb
|
279
|
-
- lib/action_pack/version.rb
|
280
264
|
- lib/action_pack.rb
|
265
|
+
- lib/action_pack/version.rb
|
266
|
+
- lib/action_view.rb
|
281
267
|
- lib/action_view/base.rb
|
282
268
|
- lib/action_view/buffers.rb
|
283
269
|
- lib/action_view/context.rb
|
284
270
|
- lib/action_view/dependency_tracker.rb
|
285
271
|
- lib/action_view/digestor.rb
|
286
272
|
- lib/action_view/flows.rb
|
273
|
+
- lib/action_view/helpers.rb
|
287
274
|
- lib/action_view/helpers/active_model_helper.rb
|
288
275
|
- lib/action_view/helpers/asset_tag_helper.rb
|
289
276
|
- lib/action_view/helpers/asset_url_helper.rb
|
@@ -304,6 +291,7 @@ files:
|
|
304
291
|
- lib/action_view/helpers/rendering_helper.rb
|
305
292
|
- lib/action_view/helpers/sanitize_helper.rb
|
306
293
|
- lib/action_view/helpers/tag_helper.rb
|
294
|
+
- lib/action_view/helpers/tags.rb
|
307
295
|
- lib/action_view/helpers/tags/base.rb
|
308
296
|
- lib/action_view/helpers/tags/check_box.rb
|
309
297
|
- lib/action_view/helpers/tags/checkable.rb
|
@@ -337,11 +325,9 @@ files:
|
|
337
325
|
- lib/action_view/helpers/tags/time_zone_select.rb
|
338
326
|
- lib/action_view/helpers/tags/url_field.rb
|
339
327
|
- lib/action_view/helpers/tags/week_field.rb
|
340
|
-
- lib/action_view/helpers/tags.rb
|
341
328
|
- lib/action_view/helpers/text_helper.rb
|
342
329
|
- lib/action_view/helpers/translation_helper.rb
|
343
330
|
- lib/action_view/helpers/url_helper.rb
|
344
|
-
- lib/action_view/helpers.rb
|
345
331
|
- lib/action_view/locale/en.yml
|
346
332
|
- lib/action_view/log_subscriber.rb
|
347
333
|
- lib/action_view/lookup_context.rb
|
@@ -356,49 +342,47 @@ files:
|
|
356
342
|
- lib/action_view/renderer/template_renderer.rb
|
357
343
|
- lib/action_view/routing_url_for.rb
|
358
344
|
- lib/action_view/tasks/dependencies.rake
|
345
|
+
- lib/action_view/template.rb
|
359
346
|
- lib/action_view/template/error.rb
|
347
|
+
- lib/action_view/template/handlers.rb
|
360
348
|
- lib/action_view/template/handlers/builder.rb
|
361
349
|
- lib/action_view/template/handlers/erb.rb
|
362
350
|
- lib/action_view/template/handlers/raw.rb
|
363
|
-
- lib/action_view/template/handlers.rb
|
364
351
|
- lib/action_view/template/resolver.rb
|
365
352
|
- lib/action_view/template/text.rb
|
366
353
|
- lib/action_view/template/types.rb
|
367
|
-
- lib/action_view/template.rb
|
368
354
|
- lib/action_view/test_case.rb
|
369
355
|
- lib/action_view/testing/resolvers.rb
|
356
|
+
- lib/action_view/vendor/html-scanner.rb
|
370
357
|
- lib/action_view/vendor/html-scanner/html/document.rb
|
371
358
|
- lib/action_view/vendor/html-scanner/html/node.rb
|
372
359
|
- lib/action_view/vendor/html-scanner/html/sanitizer.rb
|
373
360
|
- lib/action_view/vendor/html-scanner/html/selector.rb
|
374
361
|
- lib/action_view/vendor/html-scanner/html/tokenizer.rb
|
375
362
|
- lib/action_view/vendor/html-scanner/html/version.rb
|
376
|
-
- lib/action_view/vendor/html-scanner.rb
|
377
|
-
- lib/action_view.rb
|
378
363
|
homepage: http://www.rubyonrails.org
|
379
364
|
licenses:
|
380
365
|
- MIT
|
366
|
+
metadata: {}
|
381
367
|
post_install_message:
|
382
368
|
rdoc_options: []
|
383
369
|
require_paths:
|
384
370
|
- lib
|
385
371
|
required_ruby_version: !ruby/object:Gem::Requirement
|
386
|
-
none: false
|
387
372
|
requirements:
|
388
|
-
- -
|
373
|
+
- - ">="
|
389
374
|
- !ruby/object:Gem::Version
|
390
375
|
version: 1.9.3
|
391
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
392
|
-
none: false
|
393
377
|
requirements:
|
394
|
-
- -
|
378
|
+
- - ">"
|
395
379
|
- !ruby/object:Gem::Version
|
396
|
-
version:
|
380
|
+
version: 1.3.1
|
397
381
|
requirements:
|
398
382
|
- none
|
399
383
|
rubyforge_project:
|
400
|
-
rubygems_version:
|
384
|
+
rubygems_version: 2.2.2
|
401
385
|
signing_key:
|
402
|
-
specification_version:
|
386
|
+
specification_version: 4
|
403
387
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|
404
388
|
test_files: []
|