erp_tech_svcs 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ class AttributeValue < ActiveRecord::Base
3
3
  belongs_to :attribute_type
4
4
 
5
5
  validates_format_of :value, :with => /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, :if => :is_date?
6
- before_destroy :destroy_attribute_types_without_values
6
+ after_destroy :remove_unused_types
7
7
 
8
8
  def is_date?
9
9
  self.attribute_type.data_type == 'Date' ? true : false
@@ -34,8 +34,9 @@ class AttributeValue < ActiveRecord::Base
34
34
  end
35
35
  end
36
36
 
37
- def destroy_attribute_types_without_values
38
- self.attribute_type.destroy unless self.attribute_type.attribute_values.count > 1
37
+ def remove_unused_types
38
+ AttributeType.includes(:attribute_values).joins('LEFT OUTER JOIN attribute_values on attribute_values.attribute_type_id = attribute_types.id').where('attribute_values.id is null').each do |type|
39
+ type.destroy
40
+ end
39
41
  end
40
-
41
42
  end
@@ -91,6 +91,11 @@ module ErpTechSvcs
91
91
  self.attribute_values << attribute_value
92
92
  end
93
93
 
94
+ def method_missing(m, *args, &block)
95
+ value = get_dynamic_value_of_type(m.to_s)
96
+ (value.nil?) ? super : (return value)
97
+ end
98
+
94
99
  end
95
100
 
96
101
  end#HasRelationalDynamicAttributes
@@ -2,7 +2,7 @@ module ErpTechSvcs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_tech_svcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-25 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erp_base_erp_svcs
16
- requirement: &2161316540 !ruby/object:Gem::Requirement
16
+ requirement: &2157281520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2161316540
24
+ version_requirements: *2157281520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: erp_dev_svcs
27
- requirement: &2161316040 !ruby/object:Gem::Requirement
27
+ requirement: &2157280820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2161316040
35
+ version_requirements: *2157280820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: aws-sdk
38
- requirement: &2161315580 !ruby/object:Gem::Requirement
38
+ requirement: &2157279860 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.5.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2161315580
46
+ version_requirements: *2157279860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: delayed_job_active_record
49
- requirement: &2161315120 !ruby/object:Gem::Requirement
49
+ requirement: &2157279140 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2161315120
57
+ version_requirements: *2157279140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: paperclip
60
- requirement: &2161314660 !ruby/object:Gem::Requirement
60
+ requirement: &2157294560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - =
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 3.0.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2161314660
68
+ version_requirements: *2157294560
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pdfkit
71
- requirement: &2161314200 !ruby/object:Gem::Requirement
71
+ requirement: &2157293620 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - =
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.6
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2161314200
79
+ version_requirements: *2157293620
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sorcery
82
- requirement: &2161313740 !ruby/object:Gem::Requirement
82
+ requirement: &2157292800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - =
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 0.7.7
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2161313740
90
+ version_requirements: *2157292800
91
91
  description: This engine is implemented with the premise that services like logging,
92
92
  tracing and encryption would likely already exist in many organizations, so they
93
93
  are factored here so they can easily be re-implemented. There are default implementations