thecore_api 1.4.7 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aa7ce92de3619dbf41157fe23c11f62c5f048f9e4edb9d03edc6798dabe0cf7
|
4
|
+
data.tar.gz: 59107e400d1b8232e04d92020fda0fe7481812e7a1d643433e9e200f78996072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acdc39e15841ed237a28fa59545708d9613da256a5ab8f50604c58b0bab6d386eb8fd6e4cf8878432ba35f60267e51638de5c54d6f5a10fd341a640b04d17298
|
7
|
+
data.tar.gz: 7a36e4dc9955463c962120ac79300dc48f377b7926b352ed9d846a33ebfe79b1f6a77c810c219a5ecf354668a13ea63b8efe556a81c0581ba56d613a01d0419c
|
@@ -28,9 +28,9 @@ class Api::V1::BaseController < ActionController::API
|
|
28
28
|
rescue_from ActiveRecord::StatementInvalid, with: :unauthenticated!
|
29
29
|
rescue_from ActiveRecord::RecordInvalid, with: :invalid!
|
30
30
|
rescue_from CanCan::AccessDenied, with: :unauthorized!
|
31
|
-
rescue_from ActiveRecord::RecordNotFound, with: :not_found!
|
32
|
-
rescue_from NameError, with: :not_found!
|
33
|
-
rescue_from NoMethodError, with: :not_found!
|
31
|
+
# rescue_from ActiveRecord::RecordNotFound, with: :not_found!
|
32
|
+
# rescue_from NameError, with: :not_found!
|
33
|
+
# rescue_from NoMethodError, with: :not_found!
|
34
34
|
|
35
35
|
attr_accessor :current_user
|
36
36
|
|
@@ -44,9 +44,14 @@ class Api::V1::InfoController < Api::V1::BaseController
|
|
44
44
|
d.columns_hash.each_pair do |key, val|
|
45
45
|
pivot[model][key] = val.type unless key.ends_with? "_id"
|
46
46
|
end
|
47
|
+
# Only application record descendants to have a clean schema
|
47
48
|
pivot[model][:associations] ||= {
|
48
|
-
has_many: d.reflect_on_all_associations(:has_many).map
|
49
|
-
|
49
|
+
has_many: d.reflect_on_all_associations(:has_many).map { |a|
|
50
|
+
a.name if ((a.options[:class_name].presence || a.name).to_s.classify.constantize.new.is_a? ApplicationRecord)
|
51
|
+
}.compact,
|
52
|
+
belongs_to: d.reflect_on_all_associations(:belongs_to).map { |a|
|
53
|
+
a.name if ((a.options[:class_name].presence || a.name).to_s.classify.constantize.new.is_a? ApplicationRecord)
|
54
|
+
}.compact
|
50
55
|
}
|
51
56
|
end
|
52
57
|
render json: pivot.to_json, status: 200
|
data/lib/thecore_api/version.rb
CHANGED