Skip to content

Commit

Permalink
Use positional arguments for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
aspettl committed Aug 13, 2024
1 parent bdabb8c commit 0966e92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Account < ApplicationRecord

belongs_to :domain

enum type: { local_mailbox: 0, alias_address: 1, blackhole_address: 2 }
enum :type, { local_mailbox: 0, alias_address: 1, blackhole_address: 2 }

attr_accessor :password

Expand Down
2 changes: 1 addition & 1 deletion app/models/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Domain < ApplicationRecord
belongs_to :user
has_many :accounts, dependent: :destroy

enum type: { local_domain: 0, alias_domain: 1 }
enum :type, { local_domain: 0, alias_domain: 1 }

validates :type, inclusion: { in: types.keys }
validates :domain, uniqueness: true, format: { with: DOMAIN_REGEXP }, length: { maximum: 255 }
Expand Down

0 comments on commit 0966e92

Please sign in to comment.