Ensure to get also deleted entries in belongs_to assoc.
This commit is contained in:
parent
b0e12d177e
commit
c18fb20115
8 changed files with 8 additions and 8 deletions
|
@ -7,7 +7,7 @@ class Article < ActiveRecord::Base
|
||||||
localize_input_of :price, :tax, :deposit
|
localize_input_of :price, :tax, :deposit
|
||||||
|
|
||||||
# Associations
|
# Associations
|
||||||
belongs_to :supplier
|
belongs_to :supplier, :with_deleted => true
|
||||||
belongs_to :article_category
|
belongs_to :article_category
|
||||||
has_many :article_prices, :order => "created_at DESC"
|
has_many :article_prices, :order => "created_at DESC"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class ArticlePrice < ActiveRecord::Base
|
class ArticlePrice < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :article
|
belongs_to :article, :with_deleted => true
|
||||||
has_many :order_articles
|
has_many :order_articles
|
||||||
|
|
||||||
validates_presence_of :price, :tax, :deposit, :unit_quantity
|
validates_presence_of :price, :tax, :deposit, :unit_quantity
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Delivery < ActiveRecord::Base
|
class Delivery < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :supplier
|
belongs_to :supplier, :with_deleted => true
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :stock_changes, :dependent => :destroy
|
has_many :stock_changes, :dependent => :destroy
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# financial transactions are the foodcoop internal financial transactions
|
# financial transactions are the foodcoop internal financial transactions
|
||||||
# only ordergroups have an account balance and are happy to transfer money
|
# only ordergroups have an account balance and are happy to transfer money
|
||||||
class FinancialTransaction < ActiveRecord::Base
|
class FinancialTransaction < ActiveRecord::Base
|
||||||
belongs_to :ordergroup
|
belongs_to :ordergroup, :with_deleted => true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates_presence_of :amount, :note, :user_id, :ordergroup_id
|
validates_presence_of :amount, :note, :user_id, :ordergroup_id
|
||||||
|
|
|
@ -4,7 +4,7 @@ class GroupOrder < ActiveRecord::Base
|
||||||
attr_accessor :group_order_articles_attributes
|
attr_accessor :group_order_articles_attributes
|
||||||
|
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
belongs_to :ordergroup
|
belongs_to :ordergroup, :with_deleted => true
|
||||||
has_many :group_order_articles, :dependent => :destroy
|
has_many :group_order_articles, :dependent => :destroy
|
||||||
has_many :order_articles, :through => :group_order_articles
|
has_many :order_articles, :through => :group_order_articles
|
||||||
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"
|
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Invoice < ActiveRecord::Base
|
class Invoice < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :supplier
|
belongs_to :supplier, :with_deleted => true
|
||||||
belongs_to :delivery
|
belongs_to :delivery
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Order < ActiveRecord::Base
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
||||||
has_many :stock_changes
|
has_many :stock_changes
|
||||||
belongs_to :supplier
|
belongs_to :supplier, :with_deleted => true
|
||||||
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
||||||
belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'
|
belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class OrderArticle < ActiveRecord::Base
|
||||||
attr_reader :update_current_price
|
attr_reader :update_current_price
|
||||||
|
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
belongs_to :article
|
belongs_to :article, :with_deleted => true
|
||||||
belongs_to :article_price
|
belongs_to :article_price
|
||||||
has_many :group_order_articles, :dependent => :destroy
|
has_many :group_order_articles, :dependent => :destroy
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue