foodsoft/app/lib/articles_csv.rb

44 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2023-01-06 16:55:40 +01:00
class ArticlesCsv < RenderCsv
2020-06-22 16:03:32 +02:00
include ApplicationHelper
def header
[
Article.human_attribute_name(:availability_short),
2020-06-22 16:03:32 +02:00
Article.human_attribute_name(:order_number),
Article.human_attribute_name(:name),
Article.human_attribute_name(:note),
Article.human_attribute_name(:manufacturer),
Article.human_attribute_name(:origin),
Article.human_attribute_name(:unit),
Article.human_attribute_name(:price),
Article.human_attribute_name(:tax),
Article.human_attribute_name(:deposit),
Article.human_attribute_name(:unit_quantity),
'',
'',
2023-01-06 16:27:41 +01:00
Article.human_attribute_name(:article_category)
2020-06-22 16:03:32 +02:00
]
end
def data
@object.each do |o|
yield [
o.availability ? I18n.t('simple_form.yes') : I18n.t('simple_form.no'),
2020-06-22 16:03:32 +02:00
o.order_number,
o.name,
o.note,
o.manufacturer,
o.origin,
o.unit,
o.price,
o.tax,
o.deposit,
o.unit_quantity,
'',
'',
2023-01-06 16:27:41 +01:00
o.article_category.try(:name)
2020-06-22 16:03:32 +02:00
]
end
end
end