standardapi 5.0.0.5 → 5.0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ddf2593f95bb453a53bca52257c21509a8a4042
4
- data.tar.gz: f589c7fb725ea99636d6a04112fe83cf0647dc26
3
+ metadata.gz: 77989eca000ed99df1008559e61b8f65b6f60760
4
+ data.tar.gz: e074a398c3c73ebb8d49a7c1df6cbd41f5adb877
5
5
  SHA512:
6
- metadata.gz: 1ec52191db1bfbc6bb3309f33b4870e26f964402a70e21a840e8f5e22847e9be76c7f9c86be6fd65131815e1a757c5b23e9e28e3f8ad1e8d789b28500bf932e0
7
- data.tar.gz: 746e50e142dc29c8bea3ef2e9af5351b0f0887a850ed41804bbcdfeffb5a7eab59f71757392c8b3415be237f43b17aec703a7ebfc4f6b30611bfc29370081636
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
- excludes = Class.new.send(:include, ApplicationHelper).new.excludes.with_indifferent_access
132
- excludes.try(:[], klass.model_name.singular) || []
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
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.0.0.5'
2
+ VERSION = '5.0.0.6'
3
3
  end
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.5
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-28 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails