maquina 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/concerns/maquina/create.rb +1 -0
- data/app/controllers/concerns/maquina/destroy.rb +4 -3
- data/app/controllers/concerns/maquina/edit.rb +1 -2
- data/app/controllers/concerns/maquina/index.rb +1 -1
- data/app/controllers/concerns/maquina/resourceful.rb +2 -2
- data/app/controllers/concerns/maquina/update.rb +3 -2
- data/lib/maquina/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 364438ad137141326a74edaa58326851f341adc1f8acb322dd8a97cb5978a083
|
4
|
+
data.tar.gz: 970677e48f9feb4134fc488a83026a50c73d7db3ce95b840fde885240161aa4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed1dca346e40c2fe3ae250c83fa614865ba3f3bc8a6a2889aae2b455ac330e779ecc00132996be2b1512b7f1531a91ef0098d2c94b636ba0af9fe3b0bcd86dcf
|
7
|
+
data.tar.gz: df0df2c766a02f9395b98c3e9a127e8e7fc8b29ba88df23c3041cde9de50cf8295d1243d012c1c8cea8e7def0c70b6e55ac34d560802d7392cebac88b0989616
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
12
|
-
|
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
|
-
|
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
|
|
@@ -65,9 +65,9 @@ module Maquina
|
|
65
65
|
method_name = :secure_params
|
66
66
|
method_action_name = "#{action_name}_#{method_name}".to_sym
|
67
67
|
|
68
|
-
if respond_to?(method_action_name)
|
68
|
+
if respond_to?(method_action_name, true)
|
69
69
|
send(method_action_name)
|
70
|
-
elsif respond_to?(method_name)
|
70
|
+
elsif respond_to?(method_name, true)
|
71
71
|
send(method_name)
|
72
72
|
else
|
73
73
|
params.require(resource_class.model_name.element.to_sym).permit(form_attributes.flat_map { |field| field.keys })
|
@@ -8,8 +8,8 @@ module Maquina
|
|
8
8
|
def update(&block)
|
9
9
|
@resource ||= begin
|
10
10
|
scope = resource_class
|
11
|
-
|
12
|
-
|
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
|
|
data/lib/maquina/version.rb
CHANGED