Sha256: 2a34dc768e593e0f019c62f7501c1ce91b2206b89838fc8a5c7774859a41f2c9

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

class Person < Resource
  attributes :name, :id, :photo, :tagline
  
  def path
    "/people/#{@id}"
  end
  
  def setup_associations
    has_many :replies, :url => "#{path}/replies"
    has_many :topics, :url => "#{path}/topics"
    has_many :followed_topics, :url => "#{path}/followed/topics", :class_name => 'Topic'
  end
end

class Me < Person  
  def path
    loaded? ? super : "/me"
  end
  
  def was_loaded(result)
    @id = self.attributes["id"]
    setup_associations
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-satisfaction-0.2.0 lib/satisfaction/person.rb