Skip to content

Move currently_valid_prices to a method#4073

Merged
kennyadsl merged 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/move_currently_valid_to_a_price
May 28, 2021
Merged

Move currently_valid_prices to a method#4073
kennyadsl merged 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/move_currently_valid_to_a_price

Conversation

@waiting-for-dev
Copy link
Copy Markdown
Contributor

Having currently_valid_prices as an association between Variant and
Price made it a source of inconsistencies with the undecorated
prices association:

Spree::Variant.new.tap do |v|
  v.currently_valid_prices << Spree::Price.new
end.prices.any? # => false

Note: Extraction from #3994

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Comment thread core/app/models/spree/variant.rb
Comment thread core/spec/models/spree/price_spec.rb
Comment thread core/app/models/concerns/spree/default_price.rb Outdated
Having `currently_valid_prices` as an association between `Variant` and
`Price` made it a source of inconsistencies with the undecorated
`prices` association:

```
Spree::Variant.new.tap do |v|
  v.currently_valid_prices << Spree::Price.new
end.prices.any? # => false
```
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/move_currently_valid_to_a_price branch from 3730274 to 515fbe5 Compare May 21, 2021 13:21
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Makes sense

@kennyadsl kennyadsl merged commit 9d13705 into solidusio:master May 28, 2021
@kennyadsl kennyadsl deleted the waiting-for-dev/move_currently_valid_to_a_price branch May 28, 2021 09:41
@kennyadsl kennyadsl added the changelog:solidus_core Changes to the solidus_core gem label May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants