Add and inherit from ApplicationRecord to match Rails 5.0 style
This commit is contained in:
parent
8c6d48da86
commit
abe847c0ee
34 changed files with 56 additions and 66 deletions
|
|
@ -1,4 +1,4 @@
|
|||
class Delivery < ActiveRecord::Base
|
||||
class Delivery < ApplicationRecord
|
||||
|
||||
belongs_to :supplier
|
||||
belongs_to :invoice
|
||||
|
|
@ -39,13 +39,11 @@ class Delivery < ActiveRecord::Base
|
|||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def stock_articles_must_be_unique
|
||||
unless stock_changes.reject{|sc| sc.marked_for_destruction?}.map {|sc| sc.stock_article.id}.uniq!.nil?
|
||||
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue