model_driven_api 3.2.2 → 3.2.4

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: 4282b6de5aa1f0692ad907c6e711b69c5c300ca41562311f49c33113b0c2c002
4
- data.tar.gz: 5b103be64cfedc3dca3688aedcfe4d3e0d53d5476821debc6e3a6cae96ec7d65
3
+ metadata.gz: 010f1acfbe42371a8465ba5eeae1f6a5cc0d8c7d5891c30b52ed2c9056bfd7d0
4
+ data.tar.gz: fb81afbec2d0ce91297c68b212a97e213c0b0d7cf15630c82af753f5511ec1f7
5
5
  SHA512:
6
- metadata.gz: 50fbc04a16be3c132b3b1afbb95a5730f766c6b51310d49cc49b76a139138cd42eeb45a1359ac855d69d8bab8df7eddff8c8093610c961c42376bcc1a5e52832
7
- data.tar.gz: a77ade2a13edb03093a425c0e01c3d6c1ffb526557463a1b02f2b8d63a8e99776b7d2ce21b94481520fc832a2e7b899103f687cb659323f1506fa04fb6e7860a
6
+ metadata.gz: '01941ccd88639849a80e1068266b083911915793f0513835e6caf2c61b718d7c4c80d0c57c4a59f25f4a64ddf85a728d18fccada0cf7e53e813b39293b26b339'
7
+ data.tar.gz: e9243797670a8dba2dbd87a2e79571dbb5e39dea8fa26379934a08fe74137db7bb053fc73bbb63d811962397bff5e4cb64c11fdf7b65b5abcfe363827a7185df
@@ -53,7 +53,7 @@ class Api::V2::ApplicationController < ActionController::API
53
53
  end
54
54
 
55
55
  def show
56
- authorize! :show, @record_id
56
+ authorize! :show, @record_id.presence || @model
57
57
 
58
58
  # Custom Show Action
59
59
  status, result, status_number = check_for_custom_action
@@ -66,7 +66,8 @@ class Api::V2::ApplicationController < ActionController::API
66
66
 
67
67
  def create
68
68
  # Normal Create Action
69
- authorize! :create, @record
69
+ Rails.logger.debug("Creating a new record #{@record}")
70
+ authorize! :create, @record.presence || @model
70
71
  # Custom Action
71
72
  status, result, status_number = check_for_custom_action
72
73
  return render json: result, status: (status_number.presence || 200) if status == true
@@ -79,7 +80,7 @@ class Api::V2::ApplicationController < ActionController::API
79
80
  end
80
81
 
81
82
  def update
82
- authorize! :update, @record
83
+ authorize! :update, @record.presence || @model
83
84
 
84
85
  # Custom Action
85
86
  status, result, status_number = check_for_custom_action
@@ -102,7 +103,7 @@ class Api::V2::ApplicationController < ActionController::API
102
103
  end
103
104
 
104
105
  def destroy
105
- authorize! :destroy, @record
106
+ authorize! :destroy, @record.presence || @model
106
107
 
107
108
  # Custom Action
108
109
  status, result, status_number = check_for_custom_action
@@ -46,7 +46,10 @@ class Api::V2::InfoController < Api::V2::ApplicationController
46
46
  pivot[model][:associations] ||= {
47
47
  has_many: d.reflect_on_all_associations(:has_many).map { |a|
48
48
  a.name if (((a.options[:class_name].presence || a.name).to_s.classify.constantize.new.is_a? ApplicationRecord) rescue false)
49
- }.compact,
49
+ }.compact,
50
+ has_one: d.reflect_on_all_associations(:has_one).map { |a|
51
+ a.name if (((a.options[:class_name].presence || a.name).to_s.classify.constantize.new.is_a? ApplicationRecord) rescue false)
52
+ }.compact,
50
53
  belongs_to: d.reflect_on_all_associations(:belongs_to).map { |a|
51
54
  a.name if (((a.options[:class_name].presence || a.name).to_s.classify.constantize.new.is_a? ApplicationRecord) rescue false)
52
55
  }.compact
@@ -1,3 +1,3 @@
1
1
  module ModelDrivenApi
2
- VERSION = "3.2.2".freeze
2
+ VERSION = "3.2.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_driven_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-27 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubygems_version: 3.5.9
170
+ rubygems_version: 3.5.11
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Convention based RoR engine which uses DB schema introspection to create