Class: Gluttonberg::Comment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gluttonberg::Comment
- Defined in:
- app/models/gluttonberg/comment.rb
Instance Attribute Summary collapse
-
#blog_slug ⇒ Object
Returns the value of attribute blog_slug.
-
#subscribe_to_comments ⇒ Object
Returns the value of attribute subscribe_to_comments.
Instance Method Summary collapse
- #approved=(val) ⇒ Object
- #moderate(params) ⇒ Object
- #user_id ⇒ Object
- #user_id=(new_id) ⇒ Object
-
#writer_email ⇒ Object
these are helper methods for comment.
- #writer_name ⇒ Object
Instance Attribute Details
#blog_slug ⇒ Object
Returns the value of attribute blog_slug.
18 19 20 |
# File 'app/models/gluttonberg/comment.rb', line 18 def blog_slug @blog_slug end |
#subscribe_to_comments ⇒ Object
Returns the value of attribute subscribe_to_comments.
18 19 20 |
# File 'app/models/gluttonberg/comment.rb', line 18 def subscribe_to_comments @subscribe_to_comments end |
Instance Method Details
#approved=(val) ⇒ Object
64 65 66 67 |
# File 'app/models/gluttonberg/comment.rb', line 64 def approved=(val) @approve_updated = !self.moderation_required && val && self.notification_sent_at.blank? #just got approved write_attribute(:approved, val) end |
#moderate(params) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/gluttonberg/comment.rb', line 25 def moderate(params) if params == "approve" self.moderation_required = false self.approved = true self.save elsif params == "disapprove" self.moderation_required = false self.approved = false self.save else #error end end |
#user_id ⇒ Object
39 40 41 |
# File 'app/models/gluttonberg/comment.rb', line 39 def user_id self. end |
#user_id=(new_id) ⇒ Object
43 44 45 |
# File 'app/models/gluttonberg/comment.rb', line 43 def user_id=(new_id) self.=new_id end |
#writer_email ⇒ Object
these are helper methods for comment.
48 49 50 51 52 53 54 |
# File 'app/models/gluttonberg/comment.rb', line 48 def writer_email if self. self. elsif .email end end |
#writer_name ⇒ Object
56 57 58 59 60 61 62 |
# File 'app/models/gluttonberg/comment.rb', line 56 def writer_name if self. self. elsif .name end end |