Class: Cornerstone::Post

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

Instance Method Summary collapse

Instance Method Details

#author_emailObject

return the author email of the post



50
51
52
53
# File 'app/models/cornerstone/post.rb', line 50

def author_email
  #@cornerstone_email ||= anonymous_or_user_attr(:email)
  anonymous_or_user_attr(:cornerstone_email)
end

#author_nameObject

return the author name of the post



44
45
46
47
# File 'app/models/cornerstone/post.rb', line 44

def author_name
  #@cornerstone_name ||= anonymous_or_user_attr(:name)
  anonymous_or_user_attr(:cornerstone_name)
end

#created_by?(check_user) ⇒ Boolean

returns true if it was created by given user or if given user is an admin

Returns:

  • (Boolean)


56
57
58
59
60
# File 'app/models/cornerstone/post.rb', line 56

def created_by?(check_user)
  return false unless check_user.present?
  return true if check_user.cornerstone_admin?      
  self.user && self.user == check_user
end