maquina 0.2.2 → 0.2.3

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: 040c1d643734bb33ae456b0bd092b87b250d0b4d56f03548d569594f3d6892f3
4
- data.tar.gz: a17889606d8033a9e068cd212d5557f7cc77b60fd8f82d7f6f951974a526866f
3
+ metadata.gz: b7ab60b2cea0b2831706a45cfc1978c870cd116e8cbffa0b7e1c2571c07f2f00
4
+ data.tar.gz: 1dc50dfe21922c104bcf39dafb4d9c48c56005b8ac699c2539182cb4bc1460ed
5
5
  SHA512:
6
- metadata.gz: 4654d0514915f2fe7d7577ad73487a78d5b0036df114c82950a80e8f737a5b9d92bf7b163eeb316c2758428c80e0fe5dc52b13563cfeb9a2666323b62a4c773f
7
- data.tar.gz: fe807c89c747bcf9b7fc95b7590edcd331b0ee6eab5e966ebe5576fb48e580bc445552d3e5d0fd4d773cf8b36054e8b2e9c90c0d9a1c29631c96312d0b0a670e
6
+ metadata.gz: b6c5e01ae51066b823f75a917cd7241175f339c80e490a1279b1cfc2ff590ee3bbd065eb080e0113ac539e84802b43eb81c60a2cfd56271e94222dc5f94f725d
7
+ data.tar.gz: 40bb78e88253d90fcc01af052e767a8b1d44dfdb05b14c360d099bfa5dd9a134f13b03c04ae8b29bb588407c0cb64ed04963a655f2058edac131ed3987ffb95d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maquina (0.2.2)
4
+ maquina (0.2.3)
5
5
  action_policy (~> 0.6.3)
6
6
  bcrypt (~> 3.1.7)
7
7
  importmap-rails (~> 1.2.0)
@@ -16,6 +16,7 @@ module Maquina
16
16
  end
17
17
 
18
18
  @status = @resource.errors.empty? ? :created : :unprocessable_entity
19
+ Rails.logger.debug "CREATE validation: #{@resource.errors.inspect}" if status == :unprocessable_entity
19
20
  response.status = @status
20
21
  set_flash_message(@status)
21
22
 
@@ -8,10 +8,11 @@ module Maquina
8
8
  def destroy(&block)
9
9
  @resource ||= begin
10
10
  scope = resource_class
11
- # TODO: Implement policy authorization (ActionPolicy)
12
- # scope = scope.where(organization)
13
- # TODO: Implement filtering by organization
11
+ scope = authorized_scope(scope) if policy_class.present?
12
+
14
13
  scope.find_by!(find_by_param => params[:id])
14
+
15
+ authorize! resource, with: policy_class if policy_class.present?
15
16
  end
16
17
 
17
18
  @resource.destroy
@@ -8,8 +8,7 @@ module Maquina
8
8
  def edit(&block)
9
9
  @resource ||= begin
10
10
  scope = resource_class
11
- # TODO: Implement filtering by organization
12
- # scope = scope.where(organization)
11
+ scope = authorized_scope(scope) if policy_class.present?
13
12
  scope = yield(scope) if block.present?
14
13
 
15
14
  resource = scope.find_by!(find_by_param => params[:id])
@@ -14,7 +14,7 @@ module Maquina
14
14
  scope = authorized_scope(scope) if policy_class.present?
15
15
 
16
16
  search_value = params[:q]&.strip
17
- scope = scope.search_full(search_value) if search_value.present?
17
+ scope = scope.search_full(search_value) if search_value.present? && resource_class.searchable?
18
18
 
19
19
  scope = yield(scope) if block.present?
20
20
 
@@ -8,8 +8,8 @@ module Maquina
8
8
  def update(&block)
9
9
  @resource ||= begin
10
10
  scope = resource_class
11
- # scope = scope.where(organization)
12
- # TODO: Implement filtering by organization
11
+ scope = authorized_scope(scope) if policy_class.present?
12
+
13
13
  resource = scope.find_by!(find_by_param => params[:id])
14
14
 
15
15
  authorize! resource, with: policy_class if policy_class.present?
@@ -20,6 +20,7 @@ module Maquina
20
20
  saved = @resource.update(resource_secure_params)
21
21
 
22
22
  status = saved ? :accepted : :unprocessable_entity
23
+ Rails.logger.debug "UPDATE validation: #{@resource.errors.inspect}" if status == :unprocessable_entity
23
24
  response.status = status
24
25
  set_flash_message(status)
25
26
 
@@ -1,3 +1,3 @@
1
1
  module Maquina
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maquina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Alberto Chávez