Skip to content

Commit

Permalink
This models is directly invoked via graph_test.rb
Browse files Browse the repository at this point in the history
so this model has to cover both old and new enum syntax
  • Loading branch information
amatsuda committed Aug 18, 2024
1 parent 3ee739e commit 86d090c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/dummy/app/models/bug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Bug < ActiveRecord::Base
belongs_to :assigned_to, class_name: 'User'

enum :status, {unassigned: 0, assigned: 1, resolved: 2, closed: 3} do
block = ->(_) {
event :assign do
transition :unassigned => :assigned, if: -> { !!assigned_to }
end
Expand All @@ -27,6 +27,12 @@ class Bug < ActiveRecord::Base

transition all - [:closed] => :closed
end
}

if Rails::VERSION::MAJOR >= 7
enum :status, {unassigned: 0, assigned: 1, resolved: 2, closed: 3}, &block
else
enum status: {unassigned: 0, assigned: 1, resolved: 2, closed: 3}, &block
end

class Notifier
Expand Down

0 comments on commit 86d090c

Please sign in to comment.