-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to support specifying reverse association field
- Loading branch information
yann ARMAND
committed
Mar 11, 2015
1 parent
330c1b8
commit b97403b
Showing
7 changed files
with
60 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class Kid < CouchRest::Model::Base | ||
property :name, String | ||
|
||
belongs_to :dad, :class_name => 'Husband' | ||
belongs_to :mum, :class_name => 'Wife' | ||
belongs_to :dad, :class_name => 'Parent' | ||
belongs_to :mum, :class_name => 'Parent' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Parent < CouchRest::Model::Base | ||
property :name, String | ||
|
||
belongs_to :super_power | ||
belongs_to :husband, :class_name => :parent, :reverse_association => :wife | ||
belongs_to :wife, :class_name => :parent, :reverse_association => :husband | ||
belongs_to :lives_with, :class_name => :parent, :reverse_association => :lives_with | ||
|
||
collection_of :children, :class_name => 'Kid' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class SuperPower < CouchRest::Model::Base | ||
property :description, String | ||
|
||
belongs_to :parent | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters