hammock 0.5.2 → 0.5.3
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/History.txt +4 -0
- data/VERSION +1 -1
- data/hammock.gemspec +2 -2
- data/lib/hammock.rb +1 -1
- data/lib/hammock/monkey_patches/active_record.rb +7 -2
- metadata +2 -2
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/hammock.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hammock}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Hoskings"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-30}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{ben@hoskings.net}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/hammock.rb
CHANGED
@@ -92,10 +92,10 @@ module Hammock
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
def find_or_create_with(find_attributes, create_attributes = {},
|
95
|
+
def find_or_create_with(find_attributes, create_attributes = {}, should_adjust = false)
|
96
96
|
if record = find_or_new_with(find_attributes, create_attributes)
|
97
97
|
log "Create failed. #{record.errors.inspect}", :skip => 1 if record.new_record? && !record.save
|
98
|
-
log "Adjust failed. #{record.errors.inspect}", :skip => 1 if
|
98
|
+
log "Adjust failed. #{record.errors.inspect}", :skip => 1 if should_adjust && !record.adjust_attributes(create_attributes)
|
99
99
|
record
|
100
100
|
end
|
101
101
|
end
|
@@ -194,6 +194,11 @@ module Hammock
|
|
194
194
|
}
|
195
195
|
end
|
196
196
|
|
197
|
+
def adjust_attributes attrs
|
198
|
+
attributes = attrs
|
199
|
+
changed.empty? || update_attributes(attrs)
|
200
|
+
end
|
201
|
+
|
197
202
|
# Offset +attribute+ by +offset+ atomically in SQL.
|
198
203
|
def offset! attribute, offset
|
199
204
|
if new_record?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hoskings
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-30 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|