diff --git a/source/docs/relations.html.haml b/source/docs/relations.html.haml index 273cbe9..1cd4de2 100644 --- a/source/docs/relations.html.haml +++ b/source/docs/relations.html.haml @@ -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