thecore_api 1.4.7 → 1.4.9

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
  SHA256:
3
- metadata.gz: 6b37e9fc53286d912156db33f39db7ba24764e09be3a6bbc0c3442f6d1f8f781
4
- data.tar.gz: 5fb9c12a17fa54abd4b6b50c8e4a2cf10f523c8aff887d97d02a05cca589a4e1
3
+ metadata.gz: 0aa7ce92de3619dbf41157fe23c11f62c5f048f9e4edb9d03edc6798dabe0cf7
4
+ data.tar.gz: 59107e400d1b8232e04d92020fda0fe7481812e7a1d643433e9e200f78996072
5
5
  SHA512:
6
- metadata.gz: dfb94329e5b80cec683eb2f6176a5ff536b2ff94107aeb5f846c4e4c37741115b47557c19b32417ebb5ec475e57f4f8274d7443a709ceb196e1ccbc8bcf9ed1c
7
- data.tar.gz: 103912f8a6b70ebe2c65c5871ca8f249efd5c2bc25309a50ac47f24776cb2913195b3ebc63076f6516dec4f0b4f820006acb4028eca73786913ed05773a66f6d
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(&:name),
49
- belongs_to: d.reflect_on_all_associations(:belongs_to).map(&:name)
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
@@ -1,3 +1,3 @@
1
1
  module ThecoreApi
2
- VERSION = "1.4.7".freeze
2
+ VERSION = "1.4.9".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni