seamusabshere-has_timestamps 1.4.0 → 1.5.0
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.
- data/VERSION.yml +1 -1
- data/lib/has_timestamps.rb +6 -3
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/has_timestamps.rb
CHANGED
@@ -28,7 +28,8 @@ module HasTimestamps
|
|
28
28
|
|
29
29
|
has_many :timestamps, opts.merge(:as => :timestampable) do
|
30
30
|
def [](key)
|
31
|
-
fetch_timestamp(key)
|
31
|
+
t = fetch_timestamp(key, false)
|
32
|
+
t.stamped_at unless t.nil?
|
32
33
|
end
|
33
34
|
|
34
35
|
def []=(key, stamped_at)
|
@@ -41,8 +42,10 @@ module HasTimestamps
|
|
41
42
|
|
42
43
|
private
|
43
44
|
|
44
|
-
def fetch_timestamp(key)
|
45
|
-
|
45
|
+
def fetch_timestamp(key, build_if_nil = true)
|
46
|
+
t = find_by_key(key)
|
47
|
+
t = build_timestamp(key) if t.nil? and build_if_nil
|
48
|
+
t
|
46
49
|
end
|
47
50
|
|
48
51
|
def build_timestamp(key)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seamusabshere-has_timestamps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|