Skip to content

Commit 59bcaf3

Browse files
committed
validate that at least one description exists
1 parent 60eae20 commit 59bcaf3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/models/exercise.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Exercise < ActiveRecord::Base
1313
belongs_to :user
1414
belongs_to :execution_environment
1515
has_many :descriptions
16+
validates :descriptions, presence: true
1617

1718
accepts_nested_attributes_for :descriptions, allow_destroy: true
1819

0 commit comments

Comments
 (0)