activerecord-custom_timestamps 0.1.0 → 0.1.1

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.
@@ -7,4 +7,3 @@ end
7
7
 
8
8
  # defaults
9
9
  CustomTimestamps.update_custom_updated_timestamp_on_create = true
10
-
@@ -8,14 +8,12 @@ module CustomTimestamps
8
8
  class_attribute :created_timestamp, instance_writer: false
9
9
  class_attribute :updated_timestamp, instance_writer: false
10
10
  class_attribute :update_custom_updated_timestamp_on_create, instance_writer: false
11
- puts "now module.object_id=#{CustomTimestamps.object_id} && module.update_custom_updated_timestamp_on_create?=#{CustomTimestamps.update_custom_updated_timestamp_on_create?}"
12
11
  self.update_custom_updated_timestamp_on_create = CustomTimestamps.update_custom_updated_timestamp_on_create?
13
12
  end
14
13
 
15
14
  private
16
15
 
17
16
  def create
18
- puts "create called. self.created_timestamp=#{self.created_timestamp} && self.record_timestamps=#{self.record_timestamps}"
19
17
  if self.record_timestamps
20
18
  current_time = current_time_from_proper_timezone
21
19
  if self.created_timestamp
@@ -26,12 +24,9 @@ module CustomTimestamps
26
24
  end
27
25
  end
28
26
 
29
- puts "self.update_custom_updated_timestamp_on_create?=#{self.update_custom_updated_timestamp_on_create?} self.record_timestamps=#{self.record_timestamps} self.updated_timestamp=#{self.updated_timestamp}"
30
27
  if self.updated_timestamp && self.update_custom_updated_timestamp_on_create?
31
- puts "going to write to self.updated_timestamp=#{self.updated_timestamp}"
32
28
  Array.wrap(self.updated_timestamp).each do |column|
33
29
  if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
34
- puts "writing updated time #{current_time} to #{column.to_s}"
35
30
  write_attribute(column.to_s, current_time)
36
31
  end
37
32
  end
@@ -42,19 +37,16 @@ module CustomTimestamps
42
37
  end
43
38
 
44
39
  def update(*args)
45
- puts "update called"
46
- # should_record_timestamps? checks for changes, i.e. self.record_timestamps && (!partial_updates? || changed? || (attributes.keys & self.class.serialized_attributes.keys).present?)
47
40
  if self.updated_timestamp && should_record_timestamps?
48
41
  current_time = current_time_from_proper_timezone
49
-
50
42
  Array.wrap(self.updated_timestamp).each do |column|
51
43
  column = column.to_s
52
44
  next if attribute_changed?(column)
53
45
  write_attribute(column, current_time)
54
46
  end
55
47
  end
48
+
56
49
  super
57
50
  end
58
-
59
51
  end
60
52
  end
@@ -4,8 +4,7 @@ module CustomTimestamps
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "custom_timestamps.active_record" do
6
6
  ActiveSupport.on_load(:active_record) do
7
- # ActiveRecord::Base gets new behavior
8
- include CustomTimestamps::Model # ActiveSupport::Concern
7
+ include CustomTimestamps::Model
9
8
  end
10
9
  end
11
10
  end
@@ -1,3 +1,3 @@
1
1
  module CustomTimestamps
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,32 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-custom_timestamps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ prerelease:
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gary S. Weaver
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
16
+ version_requirements: !ruby/object:Gem::Requirement
18
17
  requirements:
19
18
  - - ! '>='
20
19
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
20
+ version: !binary |-
21
+ MA==
25
22
  none: false
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - ! '>='
28
26
  - !ruby/object:Gem::Version
29
- version: '0'
27
+ version: !binary |-
28
+ MA==
29
+ none: false
30
+ prerelease: false
31
+ type: :runtime
30
32
  description: Allows sets of custom timestamps for all or some models.
31
33
  email:
32
34
  - garysweaver@gmail.com
@@ -34,36 +36,44 @@ executables: []
34
36
  extensions: []
35
37
  extra_rdoc_files: []
36
38
  files:
37
- - lib/activerecord-custom_timestamps/config.rb
38
- - lib/activerecord-custom_timestamps/model.rb
39
- - lib/activerecord-custom_timestamps/railtie.rb
40
- - lib/activerecord-custom_timestamps/version.rb
41
- - lib/activerecord-custom_timestamps.rb
39
+ - !binary |-
40
+ bGliL2FjdGl2ZXJlY29yZC1jdXN0b21fdGltZXN0YW1wcy5yYg==
41
+ - !binary |-
42
+ bGliL2FjdGl2ZXJlY29yZC1jdXN0b21fdGltZXN0YW1wcy9jb25maWcucmI=
43
+ - !binary |-
44
+ bGliL2FjdGl2ZXJlY29yZC1jdXN0b21fdGltZXN0YW1wcy9tb2RlbC5yYg==
45
+ - !binary |-
46
+ bGliL2FjdGl2ZXJlY29yZC1jdXN0b21fdGltZXN0YW1wcy9yYWlsdGllLnJi
47
+ - !binary |-
48
+ bGliL2FjdGl2ZXJlY29yZC1jdXN0b21fdGltZXN0YW1wcy92ZXJzaW9uLnJi
42
49
  - Rakefile
43
50
  - README.md
44
51
  homepage: https://github.com/garysweaver/activerecord-custom_timestamps
45
52
  licenses:
46
53
  - MIT
47
- post_install_message:
54
+ post_install_message:
48
55
  rdoc_options: []
49
56
  require_paths:
50
57
  - lib
51
58
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
59
  requirements:
54
60
  - - ! '>='
55
61
  - !ruby/object:Gem::Version
56
- version: '0'
57
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ version: !binary |-
63
+ MA==
58
64
  none: false
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
66
  requirements:
60
67
  - - ! '>='
61
68
  - !ruby/object:Gem::Version
62
- version: '0'
69
+ version: !binary |-
70
+ MA==
71
+ none: false
63
72
  requirements: []
64
- rubyforge_project:
73
+ rubyforge_project:
65
74
  rubygems_version: 1.8.24
66
- signing_key:
75
+ signing_key:
67
76
  specification_version: 3
68
77
  summary: Custom Timestamps for ActiveRecord 3.x/4.x.
69
78
  test_files: []
79
+ ...