timestamped_column 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +1,29 @@
1
- module TimestampedColumn::ActiveRecord
2
- extend ActiveSupport::Concern
1
+ module TimestampedColumn
2
+ module ActiveRecord
3
+ extend ActiveSupport::Concern
3
4
 
4
- included do
5
- before_save :update_timestamped_column_times
6
- cattr_accessor :timestamped_columns
7
- end
5
+ included do
6
+ before_save :update_timestamped_column_times
7
+ cattr_accessor :timestamped_columns
8
+ end
8
9
 
9
- module ClassMethods
10
- def timestamped_column(column, opts={})
11
- timestamp_column = opts[:column] || "#{column}_updated_at"
10
+ module ClassMethods
11
+ def timestamped_column(column, opts={})
12
+ timestamp_column = opts[:column] || "#{column}_updated_at"
12
13
 
13
- self.timestamped_columns ||= {}
14
- self.timestamped_columns[column] = timestamp_column
14
+ self.timestamped_columns ||= {}
15
+ self.timestamped_columns[column] = timestamp_column
16
+ end
15
17
  end
16
- end
17
18
 
18
- module InstanceMethods
19
- private
20
- def update_timestamped_column_times
21
- if self.timestamped_columns && changes.any?
22
- self.timestamped_columns.each do |column, timestamp_column|
23
- if changes[column.to_s]
24
- send "#{timestamp_column}=", Time.zone.now
19
+ module InstanceMethods
20
+ private
21
+ def update_timestamped_column_times
22
+ if self.timestamped_columns && changes.any?
23
+ self.timestamped_columns.each do |column, timestamp_column|
24
+ if changes[column.to_s]
25
+ send "#{timestamp_column}=", Time.zone.now
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -1,3 +1,3 @@
1
1
  module TimestampedColumn
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timestamped_column
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70285269272880 !ruby/object:Gem::Requirement
16
+ requirement: &70338618301700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70285269272880
24
+ version_requirements: *70338618301700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70285269271000 !ruby/object:Gem::Requirement
27
+ requirement: &70338618301280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70285269271000
35
+ version_requirements: *70338618301280
36
36
  description: Records modified time for individual columns.
37
37
  email:
38
38
  - james@jamesbrooks.net