pipeline_dealers 0.0.6 → 0.0.7
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.
@@ -3,15 +3,23 @@ require "active_support/concern"
|
|
3
3
|
module PipelineDealers
|
4
4
|
class Model
|
5
5
|
module HasCustomFields
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
attr_reader :custom_fields
|
10
|
-
end
|
11
6
|
|
12
7
|
CUSTOM_FIELD_PREFIX = "custom_label_"
|
13
8
|
CUSTOM_FIELD_REGEX = /#{CUSTOM_FIELD_PREFIX}(\d+)/
|
14
9
|
|
10
|
+
def custom_fields
|
11
|
+
@custom_fields
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_attributes
|
15
|
+
@custom_fields = pld2human_fields(@attributes.delete(:custom_fields))
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def attributes_for_saving attributes
|
20
|
+
attributes.merge("custom_fields" => human2pld_fields(@custom_fields))
|
21
|
+
end
|
22
|
+
|
15
23
|
protected
|
16
24
|
|
17
25
|
def custom_field_collection
|
@@ -22,13 +30,6 @@ module PipelineDealers
|
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
25
|
-
def process_attributes
|
26
|
-
@custom_fields = pld2human_fields(@attributes.delete(:custom_fields))
|
27
|
-
end
|
28
|
-
|
29
|
-
def attributes_for_saving attributes
|
30
|
-
attributes.merge("custom_fields" => human2pld_fields(@custom_fields))
|
31
|
-
end
|
32
33
|
|
33
34
|
def pld2human_fields attributes
|
34
35
|
attributes ||= {}
|