Skip to content

Commit

Permalink
add missing relation
Browse files Browse the repository at this point in the history
  • Loading branch information
GalenkoEugene committed Oct 12, 2017
1 parent 2ed638c commit c645650
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/cartify/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Order < ApplicationRecord
has_many :addresses, dependent: :destroy
has_one :billing
has_one :shipping
has_many :books, through: :order_items
has_many :products, class_name: Cartify.product_class.to_s, through: :order_items
before_validation :set_order_status, on: :create
before_save :update_subtotal, :update_total, :connect_to_user

Expand Down
2 changes: 1 addition & 1 deletion app/models/cartify/order_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class OrderItem < ApplicationRecord
belongs_to :product, class_name: Cartify.product_class.to_s
belongs_to :order
has_one :order_status, through: :order
has_one :category, through: :product # was :book
has_one :category, through: :product, class_name: Cartify.product_class.to_s

validates :quantity, presence: true, numericality: { only_integer: true, greater_than: 0 }
validate :product_present
Expand Down
2 changes: 1 addition & 1 deletion lib/cartify/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Cartify
VERSION = '0.1.0'
VERSION = '0.1.1'
end

0 comments on commit c645650

Please sign in to comment.