Class: RailsExecution::AppModel
- Inherits:
-
Object
- Object
- RailsExecution::AppModel
- Defined in:
- lib/rails_execution/app_model.rb
Class Method Summary collapse
-
.compat_enum(column, values, **options) ⇒ Object
Supports both old (< Rails 7.0) and new (>= Rails 7.0)
enumsyntax.
Class Method Details
.compat_enum(column, values, **options) ⇒ Object
Supports both old (< Rails 7.0) and new (>= Rails 7.0) enum syntax.
15 16 17 18 19 20 21 22 |
# File 'lib/rails_execution/app_model.rb', line 15 def self.compat_enum(column, values, **) if ActiveRecord::VERSION::MAJOR >= 7 enum column, values, ** else = .transform_keys { |key| :"_#{key}" } enum({ column => values }.merge()) end end |