actionpack 3.0.4 → 3.0.5.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.
- data/lib/action_controller/metal/request_forgery_protection.rb +1 -1
- data/lib/action_dispatch/http/request.rb +1 -0
- data/lib/action_dispatch/routing/mapper.rb +19 -7
- data/lib/action_dispatch/routing/route_set.rb +3 -1
- data/lib/action_dispatch/testing/assertions/routing.rb +2 -4
- data/lib/action_pack/version.rb +2 -2
- data/lib/action_view/helpers/form_helper.rb +6 -9
- metadata +24 -16
@@ -84,7 +84,7 @@ module ActionController #:nodoc:
|
|
84
84
|
# * <tt>:only/:except</tt> - Passed to the <tt>before_filter</tt> call. Set which actions are verified.
|
85
85
|
def protect_from_forgery(options = {})
|
86
86
|
self.request_forgery_protection_token ||= :authenticity_token
|
87
|
-
|
87
|
+
prepend_before_filter :verify_authenticity_token, options
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -21,18 +21,22 @@ module ActionDispatch
|
|
21
21
|
@app, @constraints, @request = app, constraints, request
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def matches?(env)
|
25
25
|
req = @request.new(env)
|
26
26
|
|
27
27
|
@constraints.each { |constraint|
|
28
28
|
if constraint.respond_to?(:matches?) && !constraint.matches?(req)
|
29
|
-
return
|
29
|
+
return false
|
30
30
|
elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req))
|
31
|
-
return
|
31
|
+
return false
|
32
32
|
end
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
return true
|
36
|
+
end
|
37
|
+
|
38
|
+
def call(env)
|
39
|
+
matches?(env) ? @app.call(env) : [ 404, {'X-Cascade' => 'pass'}, [] ]
|
36
40
|
end
|
37
41
|
|
38
42
|
private
|
@@ -778,6 +782,14 @@ module ActionDispatch
|
|
778
782
|
# resources :posts, :comments
|
779
783
|
# end
|
780
784
|
#
|
785
|
+
# By default the :id parameter doesn't accept dots. If you need to
|
786
|
+
# use dots as part of the :id parameter add a constraint which
|
787
|
+
# overrides this restriction, e.g:
|
788
|
+
#
|
789
|
+
# resources :articles, :id => /[^\/]+/
|
790
|
+
#
|
791
|
+
# This allows any character other than a slash as part of your :id.
|
792
|
+
#
|
781
793
|
module Resources
|
782
794
|
# CANONICAL_ACTIONS holds all actions that does not need a prefix or
|
783
795
|
# a path appended since they fit properly in their scope level.
|
@@ -983,11 +995,11 @@ module ActionDispatch
|
|
983
995
|
#
|
984
996
|
# [:path]
|
985
997
|
#
|
986
|
-
#
|
998
|
+
# Set a path prefix for this resource.
|
987
999
|
#
|
988
1000
|
# resources :posts, :path => "admin"
|
989
1001
|
#
|
990
|
-
#
|
1002
|
+
# All actions for this resource will now be at +/admin/posts+.
|
991
1003
|
def resources(*resources, &block)
|
992
1004
|
options = resources.extract_options!
|
993
1005
|
|
@@ -1319,7 +1331,7 @@ module ActionDispatch
|
|
1319
1331
|
|
1320
1332
|
name = case @scope[:scope_level]
|
1321
1333
|
when :nested
|
1322
|
-
[
|
1334
|
+
[name_prefix, prefix]
|
1323
1335
|
when :collection
|
1324
1336
|
[prefix, name_prefix, collection_name]
|
1325
1337
|
when :new
|
@@ -512,7 +512,9 @@ module ActionDispatch
|
|
512
512
|
end
|
513
513
|
|
514
514
|
dispatcher = route.app
|
515
|
-
|
515
|
+
while dispatcher.is_a?(Mapper::Constraints) && dispatcher.matches?(env) do
|
516
|
+
dispatcher = dispatcher.app
|
517
|
+
end
|
516
518
|
|
517
519
|
if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params, false)
|
518
520
|
dispatcher.prepare_params!(params)
|
@@ -37,9 +37,6 @@ module ActionDispatch
|
|
37
37
|
#
|
38
38
|
# # Test a custom route
|
39
39
|
# assert_recognizes({:controller => 'items', :action => 'show', :id => '1'}, 'view/item1')
|
40
|
-
#
|
41
|
-
# # Check a Simply RESTful generated route
|
42
|
-
# assert_recognizes list_items_url, 'items/list'
|
43
40
|
def assert_recognizes(expected_options, path, extras={}, message=nil)
|
44
41
|
request = recognized_request_for(path)
|
45
42
|
|
@@ -124,7 +121,8 @@ module ActionDispatch
|
|
124
121
|
options[:controller] = "/#{controller}"
|
125
122
|
end
|
126
123
|
|
127
|
-
|
124
|
+
generate_options = options.dup.delete_if{ |k,v| defaults.key?(k) }
|
125
|
+
assert_generates(path.is_a?(Hash) ? path[:path] : path, generate_options, defaults, extras, message)
|
128
126
|
end
|
129
127
|
|
130
128
|
# A helper to make it easier to test different route configurations.
|
data/lib/action_pack/version.rb
CHANGED
@@ -541,7 +541,10 @@ module ActionView
|
|
541
541
|
end
|
542
542
|
|
543
543
|
builder = options[:builder] || ActionView::Base.default_form_builder
|
544
|
-
|
544
|
+
builder = builder.new(object_name, object, self, options, block)
|
545
|
+
output = capture(builder, &block)
|
546
|
+
output.concat builder.hidden_field(:id) if output && options[:hidden_field_id] && !builder.emitted_hidden_id?
|
547
|
+
output
|
545
548
|
end
|
546
549
|
|
547
550
|
# Returns a label tag tailored for labelling an input field for a specified attribute (identified by +method+) on an object
|
@@ -1280,14 +1283,8 @@ module ActionView
|
|
1280
1283
|
def fields_for_nested_model(name, object, options, block)
|
1281
1284
|
object = object.to_model if object.respond_to?(:to_model)
|
1282
1285
|
|
1283
|
-
|
1284
|
-
|
1285
|
-
block.call(builder)
|
1286
|
-
@template.concat builder.hidden_field(:id) unless builder.emitted_hidden_id?
|
1287
|
-
end
|
1288
|
-
else
|
1289
|
-
@template.fields_for(name, object, options, &block)
|
1290
|
-
end
|
1286
|
+
options[:hidden_field_id] = object.persisted?
|
1287
|
+
@template.fields_for(name, object, options, &block)
|
1291
1288
|
end
|
1292
1289
|
|
1293
1290
|
def nested_child_index(name)
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424095
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- 5
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 3.0.5.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David Heinemeier Hansson
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-02-
|
20
|
+
date: 2011-02-22 00:00:00 -08:00
|
19
21
|
default_executable:
|
20
22
|
dependencies:
|
21
23
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +28,14 @@ dependencies:
|
|
26
28
|
requirements:
|
27
29
|
- - "="
|
28
30
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
31
|
+
hash: 15424095
|
30
32
|
segments:
|
31
33
|
- 3
|
32
34
|
- 0
|
33
|
-
-
|
34
|
-
|
35
|
+
- 5
|
36
|
+
- rc
|
37
|
+
- 1
|
38
|
+
version: 3.0.5.rc1
|
35
39
|
type: :runtime
|
36
40
|
version_requirements: *id001
|
37
41
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +46,14 @@ dependencies:
|
|
42
46
|
requirements:
|
43
47
|
- - "="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
49
|
+
hash: 15424095
|
46
50
|
segments:
|
47
51
|
- 3
|
48
52
|
- 0
|
49
|
-
-
|
50
|
-
|
53
|
+
- 5
|
54
|
+
- rc
|
55
|
+
- 1
|
56
|
+
version: 3.0.5.rc1
|
51
57
|
type: :runtime
|
52
58
|
version_requirements: *id002
|
53
59
|
- !ruby/object:Gem::Dependency
|
@@ -357,16 +363,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
357
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
358
364
|
none: false
|
359
365
|
requirements:
|
360
|
-
- - "
|
366
|
+
- - ">"
|
361
367
|
- !ruby/object:Gem::Version
|
362
|
-
hash:
|
368
|
+
hash: 25
|
363
369
|
segments:
|
364
|
-
-
|
365
|
-
|
370
|
+
- 1
|
371
|
+
- 3
|
372
|
+
- 1
|
373
|
+
version: 1.3.1
|
366
374
|
requirements:
|
367
375
|
- none
|
368
376
|
rubyforge_project: actionpack
|
369
|
-
rubygems_version: 1.
|
377
|
+
rubygems_version: 1.5.2
|
370
378
|
signing_key:
|
371
379
|
specification_version: 3
|
372
380
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|