Skip to content

Commit

Permalink
Merge pull request #3476 from filippoliverani/use-application-record-…
Browse files Browse the repository at this point in the history
…as-base

Use ApplicationRecord as models base class
  • Loading branch information
kennyadsl authored Jan 31, 2020
2 parents 328d09a + 8b5f2c2 commit a363a74
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
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

0 comments on commit a363a74

Please sign in to comment.