-
Notifications
You must be signed in to change notification settings - Fork 31
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
Wrong number of arguments error when delete overridden in model #5
Comments
I will look into it … however I don't know why this is happening, don't think the problem is on my side tbh. |
def delete
# Remove the fixture from the competitors' fixture list
competitors.each do |competitor|
competitor.fixtures.delete(self.id)
end
self.update_attributes(deleted: true, deleted_at: Time.zone.now)
end This is from the logger
The process that produces that log output doesn't ever call |
Line 49 is |
Been using delete from Ruby's Array class fine until including mongoid-versioning though. That's why I thought it might be some weird interaction. |
Even after changing the code to use delete_if the problem persists. def delete
# Remove the fixture from the competitors' fixture list
competitors.each do |competitor|
competitor.fixtures.delete_if {|f| f.id == self.id}
end
self.update_attributes(deleted: true, deleted_at: Time.zone.now)
end |
I get a
wrong number of arguments (1 for 0)
error when trying to delete an object. I have overridden the delete method in the model so when someone tries to remove an object adeleted
flag is set and the object is left in the database.Seems the problem happens here https://github.com/haihappen/mongoid-versioning/blob/master/lib/mongoid/core_ext/versioning.rb#L50
Don't suppose you'd have a fix in mind for this, would you?
Thanks,
James.
The text was updated successfully, but these errors were encountered: