act_as_dirty 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ ## v0.0.3
2
+
3
+ * feature option using: to map integer values to array of potential string values. i.e. ['Man', 'Woman'] for gender: 0
4
+
1
5
  ## v0.0.2
2
6
 
3
7
  * corrected the homepage url
@@ -34,6 +34,7 @@ module ActAsDirty
34
34
 
35
35
  def generate_message record, attribute
36
36
  changes = record.read_changes_for_cleaning(attribute)
37
+ changes = format_values(changes) if @options[:using]
37
38
  if record.new_record?
38
39
  if @options[:create]
39
40
  message = @options[:create].call(record)
@@ -48,6 +49,13 @@ module ActAsDirty
48
49
  message
49
50
  end
50
51
 
52
+ def format_values changes
53
+ if @options[:using] and @options[:using].is_a? Array
54
+ changes = [@options[:using][changes[0]], @options[:using][changes[1]]]
55
+ end
56
+ changes
57
+ end
58
+
51
59
  end
52
60
  end
53
61
 
@@ -1,3 +1,3 @@
1
1
  module ActAsDirty
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: act_as_dirty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &5599080 !ruby/object:Gem::Requirement
16
+ requirement: &5930820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *5599080
24
+ version_requirements: *5930820
25
25
  description: Keep a log of what every user does on your system. Very useful in CRM,
26
26
  it would allow you to easily keep track of what every user has done to the record.
27
27
  email: