standardapi 5.0.0.5 → 5.0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/standard_api/controller.rb +10 -2
- data/lib/standard_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77989eca000ed99df1008559e61b8f65b6f60760
|
4
|
+
data.tar.gz: e074a398c3c73ebb8d49a7c1df6cbd41f5adb877
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47564cab964d0ec6673092a9d32374cc872c38aa65b9d284c781eeefe0c0357ebe5754a5285af24d9f6a0b7236c0d2425339d27e8c4290bfbed2b98e3bdbb395
|
7
|
+
data.tar.gz: 701d8b5ee38f2bbbfe9a3713e8fec6ec351ab4860fbd7431aa31c047c9e990c8a9cd2e35fc5654856019c4ff079b26e7197f4cc0e6479576d75f6a0a0bc247f4
|
@@ -8,6 +8,14 @@ module StandardAPI
|
|
8
8
|
klass.extend(ClassMethods)
|
9
9
|
end
|
10
10
|
|
11
|
+
def tables
|
12
|
+
controllers = ApplicationController.descendants# Dir[Rails.root.join('app/controllers/*_controller.rb')].map{ |path| path.match(/(\w+)_controller.rb/)[1].camelize+"Controller" }.map(&:safe_constantize)
|
13
|
+
controllers.select! { |c| c.ancestors.include?(self.class) && c != self.class }
|
14
|
+
controllers.map!(&:model).compact!
|
15
|
+
controllers.map!(&:table_name)
|
16
|
+
render json: controllers
|
17
|
+
end
|
18
|
+
|
11
19
|
def index
|
12
20
|
instance_variable_set("@#{model.model_name.plural}", resources.limit(limit).offset(params[:offset]).sort(orders))
|
13
21
|
end
|
@@ -128,8 +136,8 @@ module StandardAPI
|
|
128
136
|
|
129
137
|
def excludes_for(klass)
|
130
138
|
if defined?(ApplicationHelper) && ApplicationHelper.instance_methods.include?(:excludes)
|
131
|
-
|
132
|
-
|
139
|
+
excludes = Class.new.send(:include, ApplicationHelper).new.excludes.with_indifferent_access
|
140
|
+
excludes.try(:[], klass.model_name.singular) || []
|
133
141
|
else
|
134
142
|
[]
|
135
143
|
end
|
data/lib/standard_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standardapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|