Slowly getting the nested controllers working
More tests required
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class Credential < ApplicationRecord
|
||||
belongs_to :domain
|
||||
validates :email, presence: true
|
||||
validates :email, uniqueness: true
|
||||
validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i , message: "email must be valid"}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Domain < ApplicationRecord
|
||||
has_many :credentials, dependent: :destroy
|
||||
has_many :virtuals, dependent: :destroy
|
||||
validates :domain, presence: true
|
||||
validates :domain, uniqueness: true
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Virtual < ApplicationRecord
|
||||
belongs_to :domain
|
||||
validate :domain_name_exists
|
||||
validates :email, presence: true
|
||||
validates :destination, presence: true
|
||||
|
||||
Reference in New Issue
Block a user