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
def undiscard seems to violate its expected return value constraints.
# Discard the record in the database## @return [Boolean] true if successful, otherwise falsedefdiscardreturnfalseifdiscarded?run_callbacks(:discard)doupdate_attribute(self.class.discard_column,Time.current)endend
...
# Undiscard the record in the database## @return [Boolean] true if successful, otherwise falsedefundiscardreturnunlessdiscarded?# <-------- returns nilrun_callbacks(:undiscard)doupdate_attribute(self.class.discard_column,nil)endend
Shouldn't this be return false unless discarded??
Current behavior
> record = SomeModel.first
> record.discarded?
=>false> record.undiscard # should return false
nil
Expected behavior
> record = SomeModel.first
> record.discarded?
=>false> record.undiscard # should return falsefalse
Additional context
Ruby 3.1.4
Rails 7.0.7
The text was updated successfully, but these errors were encountered:
Describe the bug
https://github.com/jhawthorn/discard/blob/master/lib/discard/model.rb#L141
def undiscard
seems to violate its expected return value constraints.Shouldn't this be
return false unless discarded?
?Current behavior
Expected behavior
Additional context
The text was updated successfully, but these errors were encountered: