-
-
Notifications
You must be signed in to change notification settings - Fork 76
Do not safeguard including of Spree::Preferences::Persistable #316
Do not safeguard including of Spree::Preferences::Persistable #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so sure about Ruby not including things twice:
[9] pry(main)> module Foo
[9] pry(main)* def self.included(klass)
[9] pry(main)* puts "INCLUDED"
[9] pry(main)* end
[9] pry(main)* end
=> :included
[10] pry(main)> include Foo
INCLUDED
=> Object
[11] pry(main)> include Foo
INCLUDED
=> Object
[12] pry(main)>
Ok, maybe I did not phrased it correctly. Ruby will not append the same methods to the same class twice. Also this is a |
The safeguard prevents this module to be included because the class responds to preference (it is included in Spree::Base). My guess is that this safeguard was included to avoid including Spree::Preferences::Preferable twice (it is included by Spree::Preferences::Persistable) But Ruby will take care of not including the same module twice.
4eb5f39
to
e18442e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't know why this is here, I think we can remove it.
@@ -11,9 +11,7 @@ class Configuration < ::Spree::Base | |||
messaging: { availables: %w[true false], default: 'false' } | |||
}.freeze | |||
|
|||
unless respond_to?(:preference) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MinasMazar any chance you recall why we added this check here? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyadsl I'm sorry, but I'm not aware right now. I think we can remove it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The safeguard prevents this module to be included because the
class responds to
preference
(it is included inSpree::Base
).My guess is that this safeguard was included to avoid including
Spree::Preferences::Preferable
twice (it is included bySpree::Preferences::Persistable
)But Ruby will take care of not including the same module twice.
This will not effect user of Solidus >= 3.0, but helps to get rid of a (rather large) deprecation warning in Solidus 2.11