Skip to content

Commit 18a7612

Browse files
author
root
committed
Validate attributes presence for GithubComment and GithubIssue
1 parent e33f637 commit 18a7612

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: app/models/github_comment.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ class GithubComment < ActiveRecord::Base
33

44
belongs_to :journal
55

6-
validates_uniqueness_of :github_id, :scope => :journal_id
6+
validates :github_id, :presence => true
7+
validates :journal_id, :presence => true, :uniqueness => { :scope => :github_id }
78
end

Diff for: app/models/github_issue.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ class GithubIssue < ActiveRecord::Base
33

44
belongs_to :issue
55

6-
validates_uniqueness_of :github_id, :scope => :issue_id
6+
validates :github_id, :presence => true
7+
validates :issue_id, :presence => true, :uniqueness => { :scope => :github_id }
78
end

0 commit comments

Comments
 (0)