-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5809: remove ruby -w warnings #5921
MONGOID-5809: remove ruby -w warnings #5921
Conversation
45ed9a3
to
7857378
Compare
lib/mongoid/serializable.rb
Outdated
remove_method :include_root_in_json if method_defined?(:include_root_in_json) | ||
remove_method :include_root_in_json= if method_defined?(:include_root_in_json=) |
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.
Nice! I had to dig a bit to understand that these methods are defined in ActiveModel, and we're just re-defining them here to account for our default value Mongoid.include_root_in_json
. Maybe add a comment to that effect?
Also, there's an extra space before these lines -- we've standardized on indentations in 2-space increments.
lib/mongoid/traversable.rb
Outdated
class << self | ||
remove_method :discriminator_key if method_defined?(:discriminator_key) |
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.
Same here -- please add a comment explaining that the preceding class_attribute
creates both a getter and a setter, but we need to reimplement the getter (by delegating).
Also, the if method_defined?(...)
is unnecessary here, since we know that the preceding class_attribute
ensures the method is defined. 👍
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.
💯
MONGOID-5809
When run with ruby -w, Mongoid is fairly noisy and provides complaints about method redefinitions and overrides. Remove warnings by preventing redefinition.
Original Warnings: