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 ||= {}
@@ -1,3 +1,3 @@
1
1
  module PipelineDealers
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -3,6 +3,7 @@ require "pipeline_dealers"
3
3
  describe PipelineDealers::Model::HasCustomFields do
4
4
  class ModelWithCustomFields < PipelineDealers::Model
5
5
  include HasCustomFields
6
+
6
7
  self.collection_url = "models"
7
8
  self.attribute_name = "model"
8
9
  attrs :name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipeline_dealers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: