Documentation for un/discard is not completely correct
Closed this issue · 2 comments
aried3r commented
Lines 71 to 75 in cb3c885
I think either these should return false
if it's already discarded or the documentation should read "true if successful or a falsey value". Since the guard clause will make it return nil
.
I can submit a PR if you want. Just let me know which option you like better. :)
nunosilva800 commented
just return true if discarded?
imo, or:
def discard
discarded? ||
run_callbacks(:discard) do
update_attribute(self.class.discard_column, Time.current)
end
end
aried3r commented
I kinda like the guard clause better, even though I also like having only a single return statement. But bool OR &block
over 4 lines looks a bit weird to me.
I'll submit a PR soon!