Sha256: 8d205fab2d9327d7c6e5b80732ba83b0243807abde1c48f1a3709394053c55fc

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

module Highrise
  class Person < Subject
    include Pagination
    include Taggable
    
    def self.find_all_across_pages_since(time)
      find_all_across_pages(:params => { :since => time.to_s(:db).gsub(/[^\d]/, '') })
    end
  
    def company
      Company.find(company_id) if company_id
    end
  
    def name
      "#{first_name} #{last_name}".strip
    end
    
    def tags
      # thanks for the user Inka, http://forum.37signals.com/highrise/forums/15/topics/1312?page=2
      usertags = Array.new
      codigo = self.id
      tags = Highrise::Tag.find(:all)
      tags.each do |tag|
        id = tag.attributes["id"]
        users = Highrise::Tag.find(:all, :from => "/tags/#{id}").to_xml
        if users.scan(/#{codigo}/).size > 0
          usertags << tag.attributes["name"]
        end
      end
      usertags
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slainer68-highrise-0.6.2 lib/highrise/person.rb