Class: UserDistro

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/models/user_distro.rb

Instance Method Summary collapse

Instance Method Details

#avatar_urlObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/models/user_distro.rb', line 22

def avatar_url 
  avatar = ""
  if self.avatar != nil
    avatar = self.avatar
  else
    hash = Digest::MD5.hexdigest(self.email)
    default = "https://images-backstitch.s3.amazonaws.com/next/logos/backstitch_purple_icon.png"
    avatar = "https://www.gravatar.com/avatar/#{hash}?d=#{default}"
    # "http://unicornify.appspot.com/avatar/#{hash}?s=128"
  end
  avatar
end

#managed_feedsObject



16
17
18
19
20
# File 'lib/models/user_distro.rb', line 16

def managed_feeds
  self.managed_organizations
      .select("team_feeds.id, feeds.id AS feed_id, teams.id AS team_id, organizations.id AS organization_id, feeds.name, organizations.highlight_color, team_feeds.feed_type")
      .joins({:teams => {:team_feeds => :feed}}).where("team_feeds.feed_type = 'manual'").uniq
end