scope :active, -> { where(:status => %w[active confirmed]) }
scope :identifiable, -> { where(:data_public => true) }
+ has_one_attached :avatar
+
has_attached_file :image,
:default_url => "/assets/:class/:attachment/:style.png",
:styles => { :large => "100x100>", :small => "50x50>" }
end
def is_friends_with?(new_friend)
- friendships.where(:friend_user_id => new_friend.id).exists?
+ friendships.where(:befriendee => new_friend).exists?
end
##
##
# delete a user - leave the account but purge most personal data
def delete
+ avatar.purge
+
self.display_name = "user_#{id}"
self.description = ""
self.home_lat = nil
self.auth_provider = nil
self.auth_uid = nil
self.status = "deleted"
+
save
end