acts_as_oqgraph 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/acts_as_oqgraph.gemspec +2 -2
- data/lib/graph_edge.rb +4 -3
- data/test/test_acts_as_oqgraph.rb +7 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/acts_as_oqgraph.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_oqgraph}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Stuart Coyle"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-22}
|
13
13
|
s.description = %q{Acts As OQGraph allows ActiveRecord models to use the fast ans powerful OQGraph engine for MYSQL.}
|
14
14
|
s.email = %q{stuart.coyle@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/graph_edge.rb
CHANGED
@@ -94,9 +94,10 @@ class GraphEdge < ActiveRecord::Base
|
|
94
94
|
private
|
95
95
|
|
96
96
|
def remove_from_graph
|
97
|
-
|
98
|
-
|
99
|
-
|
97
|
+
# Ignores trying to delete nonexistent records
|
98
|
+
connection.execute <<-EOS
|
99
|
+
DELETE IGNORE FROM #{oqgraph_table_name} WHERE origid = #{self.send(self.class.from_key)} AND destid = #{self.send(self.class.to_key)};
|
100
|
+
EOS
|
100
101
|
end
|
101
102
|
|
102
103
|
def update_graph
|
@@ -219,5 +219,12 @@ class TestActsAsOqgraph < ActiveSupport::TestCase
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
+
def test_deletion_of_nonexistent_edge_raises_error
|
223
|
+
edge = @test_1.create_edge_to @test_2
|
224
|
+
ActiveRecord::Base.connection.execute("DELETE FROM test_model_oqgraph WHERE destid = #{edge.to_id} AND origid = #{edge.from_id}")
|
225
|
+
assert_raises ActiveRecord::StatementInvalid do
|
226
|
+
edge.destroy
|
227
|
+
end
|
228
|
+
end
|
222
229
|
|
223
230
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Stuart Coyle
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-22 00:00:00 +10:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|