Skip to content

Commit

Permalink
Fix delegates (Solidus 1.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmijos committed Apr 17, 2018
1 parent 5cd86df commit 26d80ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/models/spree/product_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# All write values will write to all variants (including the Master) unless that method's all_variants parameter is
# set to false, in which case it will only write to the Master variant.

delegate_belongs_to :master, :active_sale_in, :current_sale_in, :next_active_sale_in, :next_current_sale_in,
:sale_price_in, :on_sale_in?, :original_price_in, :discount_percent_in, :discount_percent, :sale_price,
:original_price, :on_sale?
delegate :active_sale_in, :current_sale_in, :next_active_sale_in, :next_current_sale_in,
:sale_price_in, :on_sale_in?, :original_price_in, :discount_percent_in, :discount_percent, :sale_price,
:original_price, :on_sale?, to: :master

# TODO also accept a class reference for calculator type instead of only a string
def put_on_sale(value, params = {})
Expand Down
2 changes: 1 addition & 1 deletion app/models/spree/sale_price.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Spree
class SalePrice < ActiveRecord::Base

belongs_to :price, class_name: "Spree::Price"
delegate_belongs_to :price, :currency
delegate :currency, to: :price

has_one :variant, through: :price

Expand Down
2 changes: 1 addition & 1 deletion app/models/spree/variant_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

has_many :sale_prices, through: :prices

delegate_belongs_to :default_price, :sale_price, :original_price, :on_sale?, :discount_percent
delegate :sale_price, :original_price, :on_sale?, :discount_percent, to: :default_price

def put_on_sale(value, params = {})
currencies = params.fetch(:currencies, [])
Expand Down

0 comments on commit 26d80ba

Please sign in to comment.