Sha256: 33ad1ced51320550752ce619ceac64c4f9c82353836a5f4d5e9bb13989b71116
Contents?: true
Size: 329 Bytes
Versions: 52
Compression:
Stored size: 329 Bytes
Contents
class Person < ActiveRecord::Base has_many :animals do def pups find(:all, :conditions => 'age < 1') end def adults find(:all, :conditions => 'age >= 1') end end validates_presence_of :name def add_animal animal animal.person = self animals << animal animal.save end end
Version data entries
52 entries across 52 versions & 10 rubygems