resource_awareness 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rails/resource.rb +1 -1
- data/lib/resource_awareness/mapper_extensions.rb +5 -1
- metadata +16 -7
data/lib/rails/resource.rb
CHANGED
@@ -5,7 +5,7 @@ module Rails
|
|
5
5
|
attr_accessor :id, :name, :singular_name, :controller_path, :name_prefix, :path_prefix, :prefix_parameters, :home_route
|
6
6
|
|
7
7
|
def initialize(entity, scope, options)
|
8
|
-
self.name_prefix = scope[:
|
8
|
+
self.name_prefix = scope[:as]
|
9
9
|
self.name = entity.to_s
|
10
10
|
self.singular_name = name.singularize
|
11
11
|
self.id = [name_prefix, name].compact.join('_')
|
@@ -23,7 +23,11 @@ module ResourceAwareness
|
|
23
23
|
# this method returns true only if this is a 'leaf call' (a call that doesn't call itself again)
|
24
24
|
# TODO: there should be a better way to determine this
|
25
25
|
def leaf_call?(entities, options)
|
26
|
-
|
26
|
+
return false if entities.many?
|
27
|
+
return false unless options.slice!(*ActionDispatch::Routing::Mapper::RESOURCE_OPTIONS).empty?
|
28
|
+
return false if options[:path_names]
|
29
|
+
return false if [:resource, :resources].include?(@scope[:scope_level])
|
30
|
+
true
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resource_awareness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Ingo Weiss
|
@@ -14,31 +15,35 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-30 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rails
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
|
-
- -
|
27
|
+
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 7712042
|
27
30
|
segments:
|
28
31
|
- 3
|
29
32
|
- 0
|
30
33
|
- 0
|
31
|
-
-
|
32
|
-
version: 3.0.0.
|
34
|
+
- rc
|
35
|
+
version: 3.0.0.rc
|
33
36
|
type: :runtime
|
34
37
|
version_requirements: *id001
|
35
38
|
- !ruby/object:Gem::Dependency
|
36
39
|
name: builder
|
37
40
|
prerelease: false
|
38
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
39
43
|
requirements:
|
40
44
|
- - ~>
|
41
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 1
|
42
47
|
segments:
|
43
48
|
- 2
|
44
49
|
- 1
|
@@ -75,23 +80,27 @@ rdoc_options: []
|
|
75
80
|
require_paths:
|
76
81
|
- lib
|
77
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
78
84
|
requirements:
|
79
85
|
- - ">="
|
80
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
81
88
|
segments:
|
82
89
|
- 0
|
83
90
|
version: "0"
|
84
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
85
93
|
requirements:
|
86
94
|
- - ">="
|
87
95
|
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
88
97
|
segments:
|
89
98
|
- 0
|
90
99
|
version: "0"
|
91
100
|
requirements: []
|
92
101
|
|
93
102
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.3.
|
103
|
+
rubygems_version: 1.3.7
|
95
104
|
signing_key:
|
96
105
|
specification_version: 3
|
97
106
|
summary: Makes Rails applications aware of their resources
|