Class: SharedArticle
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SharedArticle
- Defined in:
- app/models/shared_article.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.ransackable_attributes(_auth_object = nil) ⇒ Object
9 10 11 |
# File 'app/models/shared_article.rb', line 9 def self.ransackable_attributes(_auth_object = nil) %w[category created_on deposit id manufacturer name note number origin price scale_price scale_quantity supplier_id tax unit unit_quantity updated_on] end |
Instance Method Details
#build_new_article(supplier) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/shared_article.rb', line 13 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 |