foodsoft/app/serializers/article_serializer.rb

10 lines
266 B
Ruby
Raw Permalink Normal View History

2018-10-13 16:21:37 +02:00
class ArticleSerializer < ActiveModel::Serializer
attributes :id, :name
attributes :supplier_id, :supplier_name
attributes :unit, :unit_quantity, :note, :manufacturer, :origin, :article_category_id
def supplier_name
object.supplier.try(:name)
end
end