plutonium 0.19.3 → 0.19.4
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: 4d7de9599d39df9964bd7180767cbbae470053e71fbf40661d378f28ef32a3a4
|
4
|
+
data.tar.gz: dd068775de66ef761d2b62ebf593b2835ceeb5c923bc93f4e10430efaab4425a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6653571fe52a96f7f5c266d21133889fd35ccbf2a5f62214f8fb4d52c757365b515d7c26e53ce3bd6195009542031c6a2d2704fcd33f58b0be26a8d1c3eb3e8c
|
7
|
+
data.tar.gz: ad8ca55c44669ea107ba4d4b6f627b2266cb492b021d63bacefecbe5631eeeb417da93437bb97b182c6c1255b106c72c2d90e6f962e7127d95730c854955f250
|
@@ -13,9 +13,10 @@ module Plutonium
|
|
13
13
|
def presentable_attributes
|
14
14
|
@presentable_attributes ||= begin
|
15
15
|
presentable_attributes = permitted_attributes
|
16
|
-
if current_parent
|
16
|
+
if current_parent && !present_parent?
|
17
17
|
presentable_attributes -= [parent_input_param, :"#{parent_input_param}_id"]
|
18
|
-
|
18
|
+
end
|
19
|
+
if scoped_to_entity? && !present_scoped_entity?
|
19
20
|
presentable_attributes -= [scoped_entity_param_key, :"#{scoped_entity_param_key}_id"]
|
20
21
|
end
|
21
22
|
presentable_attributes
|
@@ -25,8 +26,12 @@ module Plutonium
|
|
25
26
|
def submittable_attributes
|
26
27
|
@submittable_attributes ||= begin
|
27
28
|
submittable_attributes = permitted_attributes
|
28
|
-
|
29
|
-
|
29
|
+
if current_parent && !submit_parent?
|
30
|
+
submittable_attributes -= [parent_input_param, :"#{parent_input_param}_id"]
|
31
|
+
end
|
32
|
+
if scoped_to_entity? && !submit_scoped_entity?
|
33
|
+
submittable_attributes -= [scoped_entity_param_key, :"#{scoped_entity_param_key}_id"]
|
34
|
+
end
|
30
35
|
submittable_attributes
|
31
36
|
end
|
32
37
|
end
|
@@ -42,6 +47,14 @@ module Plutonium
|
|
42
47
|
def build_form(record = resource_record!)
|
43
48
|
current_definition.form_class.new(record, resource_fields: submittable_attributes, resource_definition: current_definition)
|
44
49
|
end
|
50
|
+
|
51
|
+
def present_parent? = false
|
52
|
+
|
53
|
+
def present_scoped_entity? = false
|
54
|
+
|
55
|
+
def submit_parent? = present_parent?
|
56
|
+
|
57
|
+
def submit_scoped_entity? = present_scoped_entity?
|
45
58
|
end
|
46
59
|
end
|
47
60
|
end
|
@@ -48,7 +48,7 @@ module Plutonium
|
|
48
48
|
|
49
49
|
title = object.class.human_attribute_name(name)
|
50
50
|
src = case reflection.macro
|
51
|
-
when :belongs_to
|
51
|
+
when :belongs_to, :has_one
|
52
52
|
associated = object.public_send name
|
53
53
|
resource_url_for(associated, parent: nil) if associated
|
54
54
|
when :has_many
|
data/lib/plutonium/version.rb
CHANGED