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

Specify inheritance for Spree::Promotion #2572

Merged
merged 1 commit into from
Feb 15, 2018
Merged

Specify inheritance for Spree::Promotion #2572

merged 1 commit into from
Feb 15, 2018

Conversation

SamuelMartini
Copy link
Contributor

@SamuelMartini SamuelMartini commented Feb 14, 2018

it makes clear that Spree::Promotion inherit from Spree::Base and then
ActiveRecord.

With a promotion decorator present in the app, there are cases where calling a class method from an another gem on Spree::Promotion result in a NoMethodError. This is because the receiver has no superclass(just Object) and not Spree::Base as expected. It probably depend on which definition is loaded first.

The app has the following definitions:

module Spree
  Promotion.foo
end

and a custom action defined like the default on solidus_core

module Spree
  class Promotion
    module Actions
      class Custom

In some cases this results in a NoMethodError when Promotion receives foo and the same when it receives count or any other active record methods.
Adding < Spree::Base in the custom actions and rules in the app was enough to solve the issue, but I think that Spree::Promotion should inherit from Spree::Base in solidus_core as well.

it makes clear that Spree::Promotion inherit from Spree::Base and then
ActiveRecord.
@jhawthorn jhawthorn merged commit c38eab6 into solidusio:master Feb 15, 2018
@jhawthorn
Copy link
Contributor

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants