Sha256: 4b3066f1468bb224cd8350ce5d0e39d38567c22ea3c24ec733ecafc82014c77f

Contents?: true

Size: 492 Bytes

Versions: 22

Compression:

Stored size: 492 Bytes

Contents

class Person < ActiveRecord::Base
  has_many :pets
  has_one  :wallet

  accepts_nested_attributes_for :pets
  accepts_nested_attributes_for :wallet
  
  def oldest_pet
    pets.first :order => "age DESC"
  end
  
  def location_sentence
    "Hi. I'm currently in #{ current_location }"
  end  
  
  def has_pets
    pets.size > 0
  end
  
  def pets_ages_hash
   returning pets_hash = {} do
     pets.each do |pet|
       pets_hash[pet.name] = pet.age
     end
   end
  end
  
  apiable
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
benjaminkrause-restful-0.2.8 test/fixtures/models/person.rb
moviepilot-restful-0.2.18 test/fixtures/models/person.rb
moviepilot-restful-0.2.19 test/fixtures/models/person.rb
moviepilot-restful-0.2.20 test/fixtures/models/person.rb
purzelrakete-restful-0.2.10 test/fixtures/models/person.rb
purzelrakete-restful-0.2.11 test/fixtures/models/person.rb
purzelrakete-restful-0.2.12 test/fixtures/models/person.rb
purzelrakete-restful-0.2.13 test/fixtures/models/person.rb
purzelrakete-restful-0.2.14 test/fixtures/models/person.rb
purzelrakete-restful-0.2.15 test/fixtures/models/person.rb
purzelrakete-restful-0.2.16 test/fixtures/models/person.rb
purzelrakete-restful-0.2.17 test/fixtures/models/person.rb
purzelrakete-restful-0.2.18 test/fixtures/models/person.rb
purzelrakete-restful-0.2.2 test/fixtures/models/person.rb
purzelrakete-restful-0.2.3 test/fixtures/models/person.rb
purzelrakete-restful-0.2.4 test/fixtures/models/person.rb
purzelrakete-restful-0.2.5 test/fixtures/models/person.rb
purzelrakete-restful-0.2.6 test/fixtures/models/person.rb
purzelrakete-restful-0.2.7 test/fixtures/models/person.rb
purzelrakete-restful-0.2.8 test/fixtures/models/person.rb