Ensure to get also deleted entries in belongs_to assoc.

This commit is contained in:
Benjamin Meichsner 2013-03-10 19:39:59 +01:00
parent b0e12d177e
commit c18fb20115
8 changed files with 8 additions and 8 deletions

View file

@ -7,7 +7,7 @@ class Article < ActiveRecord::Base
localize_input_of :price, :tax, :deposit
# Associations
belongs_to :supplier
belongs_to :supplier, :with_deleted => true
belongs_to :article_category
has_many :article_prices, :order => "created_at DESC"

View file

@ -1,6 +1,6 @@
class ArticlePrice < ActiveRecord::Base
belongs_to :article
belongs_to :article, :with_deleted => true
has_many :order_articles
validates_presence_of :price, :tax, :deposit, :unit_quantity

View file

@ -1,6 +1,6 @@
class Delivery < ActiveRecord::Base
belongs_to :supplier
belongs_to :supplier, :with_deleted => true
has_one :invoice
has_many :stock_changes, :dependent => :destroy

View file

@ -1,7 +1,7 @@
# financial transactions are the foodcoop internal financial transactions
# only ordergroups have an account balance and are happy to transfer money
class FinancialTransaction < ActiveRecord::Base
belongs_to :ordergroup
belongs_to :ordergroup, :with_deleted => true
belongs_to :user
validates_presence_of :amount, :note, :user_id, :ordergroup_id

View file

@ -4,7 +4,7 @@ class GroupOrder < ActiveRecord::Base
attr_accessor :group_order_articles_attributes
belongs_to :order
belongs_to :ordergroup
belongs_to :ordergroup, :with_deleted => true
has_many :group_order_articles, :dependent => :destroy
has_many :order_articles, :through => :group_order_articles
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"

View file

@ -1,6 +1,6 @@
class Invoice < ActiveRecord::Base
belongs_to :supplier
belongs_to :supplier, :with_deleted => true
belongs_to :delivery
belongs_to :order

View file

@ -10,7 +10,7 @@ class Order < ActiveRecord::Base
has_one :invoice
has_many :comments, :class_name => "OrderComment", :order => "created_at"
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 :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'

View file

@ -4,7 +4,7 @@ class OrderArticle < ActiveRecord::Base
attr_reader :update_current_price
belongs_to :order
belongs_to :article
belongs_to :article, :with_deleted => true
belongs_to :article_price
has_many :group_order_articles, :dependent => :destroy