fake_rails3_routes 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -1
- data/lib/fake_rails3_routes/mapper.rb +19 -3
- data/lib/fake_rails3_routes/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Fake Rails 3 Routes
|
2
2
|
|
3
3
|
This gem adapts the Rails 3 routing code to generate Rails 2.3 routes on
|
4
4
|
the back-end, so that you can upgrade your Rails 2 routes to Rails 3
|
@@ -36,6 +36,12 @@ with:
|
|
36
36
|
FakeRails3Routes.draw do
|
37
37
|
```
|
38
38
|
|
39
|
+
### Concerns
|
40
|
+
|
41
|
+
This gem includes a backport of the `concerns` routing concept from
|
42
|
+
Rails 4. If you want to use concerns in Rails 3, just include the
|
43
|
+
`routing_concerns` (https://github.com/rails/routing_concerns) gem in your Gemfile.
|
44
|
+
|
39
45
|
## Copyright
|
40
46
|
|
41
47
|
The vast majority of this gem is extracted directly from Rails 3,
|
@@ -34,9 +34,6 @@ module FakeRails3Routes
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def to_route
|
37
|
-
#defaults.keys.reverse.each do |k|
|
38
|
-
#defaults[k] = defaults.delete(k) unless k == :controller
|
39
|
-
#end
|
40
37
|
[ conditions, requirements, defaults, @options[:as], @options[:anchor] ]
|
41
38
|
end
|
42
39
|
|
@@ -875,6 +872,8 @@ module FakeRails3Routes
|
|
875
872
|
end
|
876
873
|
|
877
874
|
resource_scope(:resource, SingletonResource.new(resources.pop, options)) do
|
875
|
+
named_concerns = options.delete(:concerns)
|
876
|
+
concerns(named_concerns)
|
878
877
|
yield if block_given?
|
879
878
|
|
880
879
|
new do
|
@@ -1013,6 +1012,8 @@ module FakeRails3Routes
|
|
1013
1012
|
end
|
1014
1013
|
|
1015
1014
|
resource_scope(:resources, Resource.new(resources.pop, options)) do
|
1015
|
+
named_concerns = options.delete(:concerns)
|
1016
|
+
concerns(named_concerns)
|
1016
1017
|
yield if block_given?
|
1017
1018
|
|
1018
1019
|
collection do
|
@@ -1172,6 +1173,21 @@ module FakeRails3Routes
|
|
1172
1173
|
self
|
1173
1174
|
end
|
1174
1175
|
|
1176
|
+
def concern(name, &block)
|
1177
|
+
@concerns ||= {}
|
1178
|
+
@concerns[name] = block
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
def concerns(*names)
|
1182
|
+
Array(names).flatten.compact.each do |name|
|
1183
|
+
if @concerns && concern = @concerns[name]
|
1184
|
+
instance_eval(&concern)
|
1185
|
+
else
|
1186
|
+
raise "No concern named #{name} was found!"
|
1187
|
+
end
|
1188
|
+
end
|
1189
|
+
end
|
1190
|
+
|
1175
1191
|
def using_match_shorthand?(path, options)
|
1176
1192
|
path && (options[:to] || options[:action]).nil? && path =~ %r{/[\w/]+$}
|
1177
1193
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_rails3_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 1995574502210346130
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 1995574502210346130
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.23
|