Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Spree::Base as models base class #3476

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/app/models/spree/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class Spree::Base < ActiveRecord::Base
include Spree::Preferences::Preferable
include Spree::Core::Permalinks
serialize :preferences, Hash

include Spree::RansackableAttributes
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/promotion_code_batch.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Spree
class PromotionCodeBatch < ActiveRecord::Base
class PromotionCodeBatch < Spree::Base
class CantProcessStartedBatch < StandardError
end

Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/promotion_rule_role.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Spree
class PromotionRuleRole < ActiveRecord::Base
class PromotionRuleRole < Spree::Base
belongs_to :promotion_rule, class_name: 'Spree::PromotionRule', optional: true
belongs_to :role, class_name: 'Spree::Role', optional: true
end
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/shipping_rate_tax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Spree
# @attr [Spree::TaxRate] tax_rate The tax rate used to calculate the tax amount
# @since 1.3.0
# @see Spree::Tax::ShippingRateTaxer
class ShippingRateTax < ActiveRecord::Base
class ShippingRateTax < Spree::Base
belongs_to :shipping_rate, class_name: "Spree::ShippingRate", optional: true
belongs_to :tax_rate, class_name: "Spree::TaxRate", optional: true

Expand Down
2 changes: 1 addition & 1 deletion core/db/default/spree/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Insert Countries into the spree_countries table, checking to ensure that no
# duplicates are created, using as few SQL statements as possible (2)

connection = ApplicationRecord.connection
connection = Spree::Base.connection

country_mapper = ->(country) do
name = connection.quote country.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Solidus
module Migrations
module PromotionWithCodeHandlers
class PromotionCode < ActiveRecord::Base
class PromotionCode < Spree::Base
self.table_name = "spree_promotion_codes"
end

Expand Down
4 changes: 1 addition & 3 deletions core/lib/spree/core/permalinks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Permalinks
class_attribute :permalink_options
end

module ClassMethods
class_methods do
def make_permalink(options = {})
options[:field] ||= :permalink
self.permalink_options = options
Expand Down Expand Up @@ -63,5 +63,3 @@ def save_permalink(permalink_value = to_param)
end
end
end

ActiveRecord::Base.send :include, Spree::Core::Permalinks