rest_framework 0.6.12 → 0.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/controller_mixins/models.rb +12 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc66a1bc2a8c965fcaf04106db51a08c98623a642803634fc96d5eccce9283f
|
4
|
+
data.tar.gz: 06c49e1eb116813833c01810379a7f377023bb37a0bb57429c254224f8b260d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6398f494b9c920a0e9765733c6be871d0cdee94fc12a2863fa7bf0bfc1bba41f601713a53b61ba3d57fcd1b3b45001eadbe6ac26b77b4bd69595ad1ae84e2f06
|
7
|
+
data.tar.gz: 2610d28a5d5b98fd6be70105d04a292d2acb4c3efc9d5ece74ba1a00b90e4968a55ccefc824773c2609015298221c5315ea929440e29923bba9500ce495c8c78
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.13
|
@@ -13,19 +13,24 @@ module RESTFramework::BaseModelControllerMixin
|
|
13
13
|
return @model if @model
|
14
14
|
return (@model = self.model) if self.model
|
15
15
|
|
16
|
+
# Try to determine model from controller name.
|
17
|
+
begin
|
18
|
+
return @model = self.name.demodulize.chomp("Controller").singularize.constantize
|
19
|
+
rescue NameError
|
20
|
+
end
|
21
|
+
|
16
22
|
# Delegate to the recordset's model, if it's defined.
|
17
23
|
unless from_get_recordset # Prevent infinite recursion.
|
18
|
-
|
24
|
+
# Instantiate a new controller to get the recordset.
|
25
|
+
controller = self.new
|
26
|
+
controller.request = ActionController::TestRequest.new
|
27
|
+
controller.params = {}
|
28
|
+
|
29
|
+
if (recordset = controller.get_recordset)
|
19
30
|
return @model = recordset.klass
|
20
31
|
end
|
21
32
|
end
|
22
33
|
|
23
|
-
# Try to determine model from controller name.
|
24
|
-
begin
|
25
|
-
return @model = self.name.demodulize.match(/(.*)Controller/)[1].singularize.constantize
|
26
|
-
rescue NameError
|
27
|
-
end
|
28
|
-
|
29
34
|
return nil
|
30
35
|
end
|
31
36
|
|