Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
destroy_all
for has_many :through
associations that points to…
… a CPK model
- Loading branch information
1 parent
01363bd
commit 892e4ae
Showing
8 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
_fixture: | ||
model_class: Cpk::OrderTag | ||
|
||
cpk_first_order_loyal_customer: | ||
tag_id: <%= ActiveRecord::FixtureSet.identify(:cpk_tag_loyal_customer) %> | ||
order_id: <%= ActiveRecord::FixtureSet.composite_identify(:cpk_groceries_order_1, [:shop_id, :id])[:id] %> | ||
|
||
cpk_second_order_loyal_customer: | ||
tag_id: <%= ActiveRecord::FixtureSet.identify(:cpk_tag_loyal_customer) %> | ||
order_id: <%= ActiveRecord::FixtureSet.composite_identify(:cpk_groceries_order_2, [:shop_id, :id])[:id] %> | ||
|
||
cpk_first_order_digital_product: | ||
tag_id: <%= ActiveRecord::FixtureSet.identify(:cpk_tag_digital_product) %> | ||
order_id: <%= ActiveRecord::FixtureSet.composite_identify(:cpk_groceries_order_1, [:shop_id, :id])[:id] %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
_fixture: | ||
model_class: Cpk::Tag | ||
|
||
cpk_tag_loyal_customer: | ||
name: "Loyal customer" | ||
|
||
cpk_tag_digital_product: | ||
name: "Digital product" | ||
|
||
cpk_tag_ruby_on_rails: | ||
name: "Ruby on Rails" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cpk | ||
class OrderTag < ActiveRecord::Base | ||
self.table_name = :cpk_order_tags | ||
|
||
belongs_to :tag | ||
belongs_to :order, primary_key: :id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cpk | ||
class Tag < ActiveRecord::Base | ||
self.table_name = :cpk_tags | ||
|
||
has_many :order_tags | ||
has_many :orders, through: :order_tags | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters