Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dznz/mongoid-site into dz…
Browse files Browse the repository at this point in the history
…nz-master
  • Loading branch information
durran committed Jan 2, 2012
2 parents 0002432 + f9cc848 commit c4c2bbd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/docs/relations.html.haml
Expand Up @@ -53,9 +53,15 @@
def find_by_country(country)
where(country: country).first
end
def chinese
@target.select { |address| address.country == "China"}
end
end
end

person.addresses.find_by_country('Mongolia') #=> returns address
person.addresses.chinese #=> returns [ address ]

%h3 custom relation names

%p
Expand Down

0 comments on commit c4c2bbd

Please sign in to comment.