Refactor Events action constants into Rails enum method
Summary
"Event class needs refactoring to leverage Rails enums. It will simplify the code significantly." - #7168 (comment 327105946)
Improvements
Consolidate Event
model's various action constants into a single call to Rails enum
, and make any necessary changes to accommodate that.
Note: The events#action
column is already correctly configured as a SMALLINT in the database, so this is purely a Ruby change.
Risks
Minimal risks. Rails enum
attributes are more flexible, not less.
Involved components
- app/models/event.rb
Optional: Intended side effects
- Less code
- More flexibility in writing code