Class: Exporter::Comments

Inherits:
Base
  • Object
show all
Defined in:
lib/exporter/comments.rb

Instance Attribute Summary

Attributes inherited from Base

#cart

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_csv

Constructor Details

This class inherits a constructor from Exporter::Base

Instance Method Details

#commentsObject


7
8
9
# File 'lib/exporter/comments.rb', line 7

def comments
  self.cart.comments
end

#headersObject


3
4
5
# File 'lib/exporter/comments.rb', line 3

def headers
  Comment.attributes
end

#rowsObject


15
16
17
18
19
# File 'lib/exporter/comments.rb', line 15

def rows
  self.sorted_comments.map do |comment|
    comment.to_a
  end
end

#sorted_commentsObject


11
12
13
# File 'lib/exporter/comments.rb', line 11

def sorted_comments
  self.comments.order('updated_at ASC')
end