Skip to content

Commit f71b97d

Browse files
committed
chore: fix rails 8 enum syntax
1 parent 7e62cdc commit f71b97d

File tree

1 file changed

+7
-2
lines changed
  • playground/vanilla/app/models

1 file changed

+7
-2
lines changed

playground/vanilla/app/models/song.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ class Song < ApplicationRecord
22
belongs_to :composer
33
has_many :video_clips
44

5-
enum genre: {fingerstyle: "fingerstyle", rock: "rock", classical: "classical"}
6-
enum tempo: %w[slow medium fast]
5+
if Rails::VERSION::MAJOR >= 7
6+
enum :genre, fingerstyle: "fingerstyle", rock: "rock", classical: "classical"
7+
enum :tempo, %w[slow medium fast]
8+
else
9+
enum genre: {fingerstyle: "fingerstyle", rock: "rock", classical: "classical"}
10+
enum tempo: %w[slow medium fast]
11+
end
712
end

0 commit comments

Comments
 (0)