Class: SharedArticle

Inherits:
ApplicationRecord show all
Defined in:
app/models/shared_article.rb

Instance Method Summary collapse

Instance Method Details

#build_new_article(supplier) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/shared_article.rb', line 9

def build_new_article(supplier)
  supplier.articles.build(
    name: name,
    unit: unit,
    note: note,
    manufacturer: manufacturer,
    origin: origin,
    price: price,
    tax: tax,
    deposit: deposit,
    unit_quantity: unit_quantity,
    order_number: number,
    article_category: ArticleCategory.find_match(category),
    # convert to db-compatible-string
    shared_updated_on: updated_on.to_fs(:db)
  )
end