Browse files

Aliased has_many, closes #183

  • Loading branch information...
1 parent 0d53e16 commit c8e120b7d0044fbb9bd8313646aeb4d61bc9e135 @andreasronge andreasronge committed Sep 26, 2012
Showing with 14 additions and 0 deletions.
  1. +5 −0 CHANGELOG
  2. +3 −0 lib/neo4j/rails/has_n.rb
  3. +6 −0 spec/unit/has_n_spec.rb
View
5 CHANGELOG
@@ -1,6 +1,11 @@
+
+* Aliased has_many to has_n, #183
+
== 2.2.0.rc1 / 2012-09-21
* Use neo4j-core and neo4j-wrapper version 2.2.0.rc1
* Use the neo4j-cypher gem
+* Better support for Orm Adapter, #212
+* Use Cypher query when finder method does not have a lucene index, #210
== 2.0.1 / 2012-06-06
* Use neo4j-core and neo4j-wrapper version 2.0.1
View
3 lib/neo4j/rails/has_n.rb
@@ -63,6 +63,9 @@ def has_n(*args)
define_has_n_methods_for(args.first, options)
end
+
+ alias_method :has_many, :has_n
+
# Declares ONE incoming or outgoing relationship
#
# @example
View
6 spec/unit/has_n_spec.rb
@@ -41,6 +41,12 @@ def wrapper
other_klass.new
end
+ describe 'has_many (alias of has_n)' do
+ it 'works like has_n' do
+ klass.has_many(:friends).to(other_klass)
+ puts klass._decl_rels.inspect
+ end
+ end
describe "has_one(:best_friend)" do
it "has a best_friend class method for the relationship type" do
klass.has_one(:best_friend).to(other_klass)

0 comments on commit c8e120b

Please sign in to comment.