Class: Comment

Inherits:
Item
  • Object
show all
Defined in:
app/models/comment.rb

Constant Summary

Constants inherited from Item

Item::ALLOWED_KEYS, Item::PER_PAGE, Item::TEASER_LENGTH

Instance Attribute Summary collapse

Attributes inherited from Item

#comments_count, #layout, #name, #teaser, #text

Instance Method Summary collapse

Methods inherited from Item

#comments, #generate_teaser!, #to_json, #to_param

Instance Attribute Details

#item_idObject

Returns the value of attribute item_id.



3
4
5
# File 'app/models/comment.rb', line 3

def item_id
  @item_id
end

Instance Method Details

#itemObject



9
10
11
# File 'app/models/comment.rb', line 9

def item
  _cache[:item] ||= Item.by_id item_id
end

#item=(item) ⇒ Object



5
6
7
8
# File 'app/models/comment.rb', line 5

def item= item
  self.item_id = item._id
  _cache[:item] = item
end