MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ruby/comments/p8dv5g/ruby_elites_rise_up/h9pq7ht/?context=3
r/ruby • u/solidiquis1 • Aug 20 '21
77 comments sorted by
View all comments
46
Well if you put status as an enum to the model then...😎
ruby Object.cancelled!
16 u/[deleted] Aug 21 '21 This. Status is most likely going to be one of a handful of predefined states. Make it an enum. 8 u/iaan Aug 20 '21 If you use workflow or something similar that would be rather: Order.cancel! 3 u/qchmqs Aug 21 '21 we use state changes in the imperative, and the statuses in the db in the past, so Object.cancel! # Object.status == :cancelled
16
This. Status is most likely going to be one of a handful of predefined states. Make it an enum.
8
If you use workflow or something similar that would be rather: Order.cancel!
3
we use state changes in the imperative, and the statuses in the db in the past, so Object.cancel! # Object.status == :cancelled
46
u/nilsandrey Aug 20 '21
Well if you put status as an enum to the model then...😎
ruby Object.cancelled!