Flowdock
method

include?

Importance_1
Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: CollectionProxy
include?(record) public

Returns true if the given object is present in the collection.

class Person < ActiveRecord::Base
  has_many :pets
end

person.pets # => [#<Pet id: 20, name: "Snoop">]

person.pets.include?(Pet.find(20)) # => true
person.pets.include?(Pet.find(21)) # => false
Show source
Register or log in to add new notes.