Class: Project

Inherits:
ApplicationRecord show all
Includes:
AffiliatableChild, AlgoliaSearch, Bannerable, Coordinates, Feedable, Geocodable, Interestable, Linkable, Mediumable, Membership, NotificationsHelpers, RecsysHelpers, RelationHelpers, Skillable, Utils
Defined in:
app/models/project.rb

Instance Method Summary collapse

Methods included from Utils

#obj_type, #reindex, #sanitize, #sanitize_content, #sanitize_description

Methods included from Skillable

#update_skills

Methods included from RelationHelpers

#clappers, #claps_count, #followers, #followers_count, #reviews_count, #saves_count

Methods included from RecsysHelpers

#add_edge, #remove_edge

Methods included from NotificationsHelpers

#notif_new_follower, #notif_new_member, #notif_pending_member

Methods included from Membership

#admins, #all_owners_admins_members, #has_privacy?, #members, #members_count, #owners, #pending_members, #user_is_member?, #users, #users_sm

Methods included from Interestable

#update_interests

Methods included from Geocodable

#make_address

Methods included from Feedable

#posts_count

Methods included from Coordinates

#create_coordinates

Methods included from Bannerable

#banner_url, #banner_url_sm

Methods included from AffiliatableChild

#add_affiliation_to, #remove_affiliation_to

Instance Method Details

#clean_destroyObject



90
91
92
93
94
95
# File 'app/models/project.rb', line 90

def clean_destroy
  needs.each(&:destroy)
  documents.each(&:purge)
  externalhooks.each(&:destroy)
  destroy
end


68
69
70
# File 'app/models/project.rb', line 68

def frontend_link
  "/project/#{id}"
end

#needs_countObject



60
61
62
# File 'app/models/project.rb', line 60

def needs_count
  needs.count
end

#notif_pending_join_request(requestor) ⇒ Object



72
73
74
75
76
77
78
79
# File 'app/models/project.rb', line 72

def notif_pending_join_request(requestor)
  Notification.create(
    target: requestor,
    category: :membership,
    type: 'pending_join_request',
    object: self
  )
end

#notif_pending_join_request_approved(requestor) ⇒ Object



81
82
83
84
85
86
87
88
# File 'app/models/project.rb', line 81

def notif_pending_join_request_approved(requestor)
  Notification.create(
    target: requestor,
    category: :membership,
    type: 'pending_join_request_approved',
    object: self
  )
end

#update_activity(_obj) ⇒ Object



64
65
66
# File 'app/models/project.rb', line 64

def update_activity(_obj)
  self.updated_at = Time.now
end