Class: PageComment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/page_comment.rb

Instance Method Summary collapse

Instance Method Details

#editable?(current_user) ⇒ Boolean

Returns:

  • (Boolean)

9
10
11
12
13
14
15
16
17
18
# File 'app/models/page_comment.rb', line 9

def editable?(current_user)
  if (current_user && current_user.is_admin?)
    return true
  end
  if (current_user && current_user.id == user_id)
    return true
  end
  return false

end

#notify_usObject


20
21
22
23
24
25
26
# File 'app/models/page_comment.rb', line 20

def notify_us()
#todo add current
  curriculum_comments = PageComment.where(:page_id => self.page_id, :notify_me => true).all
  email_addresses = []
  curriculum_comments.each { |comment| email_addesses << comment.user.email }
  return email_addresses
end