You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is a little deep but I'll attempt to explain. I was able to reproduce this problem with a spec in the activerecord_spec file by adding the folling under the describe '#mount_uploader' do block:
context "model has private methods" do
before do
Event.define_method(:test_a_method) {}
Event.send(:private, :test_a_method)
end
it "maintains private methods after singleton method is called" do
expect(@event.private_methods(false)).to include(:test_a_method)
@event.singleton_class
expect(@event.private_methods(false)).to include(:test_a_method)
end
end
This spec fails on the second expect call since test_a_method no longer gets returned. This is causing issues for us due to the use of the workflow gem. Specifically the has_callback? method stopped being able to find the private methods in our models. The private method is still there is true is passed instead but the purpose of the code in the workflow gem is to only load private methods in the immediate class.
If I revert the changes done in eb9c52e then this code works again. I am still unsure as to why loading the singleton class would cause the private method to no longer show up on the receiver. I will continue attempting to find a fix, but I wanted to post this issue to see if others have ideas for how to address this problem.
Let me know if you'd prefer a PR showcasing the spec and how it fails.
The text was updated successfully, but these errors were encountered:
This issue is a little deep but I'll attempt to explain. I was able to reproduce this problem with a spec in the activerecord_spec file by adding the folling under the
describe '#mount_uploader' do
block:This spec fails on the second
expect
call sincetest_a_method
no longer gets returned. This is causing issues for us due to the use of the workflow gem. Specifically the has_callback? method stopped being able to find the private methods in our models. The private method is still there istrue
is passed instead but the purpose of the code in the workflow gem is to only load private methods in the immediate class.If I revert the changes done in eb9c52e then this code works again. I am still unsure as to why loading the singleton class would cause the private method to no longer show up on the receiver. I will continue attempting to find a fix, but I wanted to post this issue to see if others have ideas for how to address this problem.
Let me know if you'd prefer a PR showcasing the spec and how it fails.
The text was updated successfully, but these errors were encountered: