From 5111ec446bedbc8d0ff6ef11de1000047e0edff5 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 18 May 2012 19:28:09 -0500 Subject: add CollectionProxy#include? documentation --- .../lib/active_record/associations/collection_proxy.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 40f59f2c77..0131fa3a5b 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -177,6 +177,19 @@ module ActiveRecord # pet.group == 'cats' # end # # => true + + ## + # :method: include? + # Returns true if the given object is present in the collection. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets # => [#] + # + # person.pets.include?(Pet.find(20)) # => true + # person.pets.include?(Pet.find(21)) # => false delegate :select, :find, :first, :last, :build, :create, :create!, :concat, :replace, :delete_all, :destroy_all, :delete, :destroy, :uniq, -- cgit v1.2.3