Skip to content

Commit

Permalink
Aliased has_many, closes #183
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasronge committed Sep 26, 2012
1 parent 0d53e16 commit c8e120b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/neo4j/rails/has_n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/has_n_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c8e120b

Please sign in to comment.