architect4r 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/ReleaseNotes.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Release Notes
2
2
 
3
+ ## v0.4.2
4
+
5
+ * Unify the finder interface and use ```Node#find(id)``` in favor of ```Node#find_by_id(id)```
6
+
7
+ Now nodes and relationships are using the same interface. Moreover, architect4r should be
8
+ more compatible with other gems (search, …).
9
+
3
10
  ## v0.4.1
4
11
 
5
12
  * Allow logging of cypher queries for easier debugging
@@ -16,15 +16,17 @@ module Architect4r
16
16
 
17
17
  # Fetch a record of the specified model based on its id
18
18
  #
19
- def find_by_id(id)
19
+ def find(id)
20
20
  data = connection.execute_cypher("start s=node(#{self.model_root.id}), d=node(#{id.to_i}) match s<-[r:model_type]-d return d")
21
21
  data &&= data['data'] && data['data'].flatten.first
22
22
  self.build_from_database(data)
23
23
  end
24
+ alias :find_by_id :find
24
25
 
25
- def find_by_id!(id)
26
+ def find!(id)
26
27
  self.find_by_id(id) || raise(Architect4r::RecordNotFound.new("Could not find the #{self.name} with id #{id}!"))
27
28
  end
29
+ alias :find_by_id! :find!
28
30
 
29
31
  # Use this method only to fetch items of the same class.
30
32
  def find_by_cypher(query, identifier)
@@ -1,3 +1,3 @@
1
1
  module Architect4r
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -7,6 +7,7 @@ describe "Node Queries" do
7
7
  describe "fetching a node" do
8
8
 
9
9
  it { should respond_to(:find_by_id) }
10
+ it { should respond_to(:find) }
10
11
 
11
12
  it "should find a node based on its id" do
12
13
  person = Person.create(:name => 'Agent Smith', :human => false)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: architect4r
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Maximilian Schulz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-31 00:00:00 Z
18
+ date: 2012-02-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemodel