-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Move spree user methods to module #13
Conversation
error = "Spree.user_class MUST be a String or Symbol object, not a Class object." | ||
raise error if @@user_class.is_a?(Class) | ||
|
||
if !@@user_class.constantize.included_modules.include? Spree::UserMethods |
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.
Would this work instead?
if !@@user_class.constantize.is_a? Spree::UserMethods
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.
No, @@user_class.constantize is a class. After talking with @jhawthorn, figured out it would need to be @@user_class.constantize.new.is_a? ... but that we didn't like that syntax
test this please |
1 similar comment
test this please |
@@ -11,58 +11,58 @@ class BaseController < Spree::BaseController | |||
|
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.
the changes in this file seem unrelated, and the previous style didn't necessarily break a convention, do you mind backing them out?
Also update LegacyUser to include User methods and move appropriate methods into the UserMethods module
Add deprication warning to initializer. If User class doesnt include UserMethods, add it and warn.
For api compatibility
|
||
if !methods_included | ||
ActiveSupport::Deprecation.warn "#{ Spree.user_class.name } must include Spree::UserMethods" | ||
Spree.user_class.class_eval { include UserMethods } |
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.
You don't need to class_eval this.
Spree.user_class.include UserMethods
I like the deprecation warning getting people to move this to their own definition rather than hacking it in for them.
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.
agreed with Gregor's comments
This was merged in #153 |
Remove default_price unscoping
Fix Teaspoon @ 1.1.5
…for-friendly-promotions Use different path for friendly promotions
Move Spree::User logic into a mixin that can be included in the Spree.user_class that is defined.