Class: Cornerstone::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Cornerstone::Post
- Defined in:
- app/models/cornerstone/post.rb
Instance Method Summary collapse
-
#author_email ⇒ Object
return the author email of the post.
-
#author_name ⇒ Object
return the author name of the post.
-
#created_by?(check_user) ⇒ Boolean
returns true if it was created by given user or if given user is an admin.
Instance Method Details
#author_email ⇒ Object
return the author email of the post
50 51 52 53 |
# File 'app/models/cornerstone/post.rb', line 50 def #@cornerstone_email ||= anonymous_or_user_attr(:email) anonymous_or_user_attr(:cornerstone_email) end |
#author_name ⇒ Object
return the author name of the post
44 45 46 47 |
# File 'app/models/cornerstone/post.rb', line 44 def #@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
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 |