Skip to content

Commit

Permalink
This also fixes the validation error, and seems less weird
Browse files Browse the repository at this point in the history
  • Loading branch information
denny committed Mar 24, 2020
1 parent b2856c1 commit a0c1a2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/models/comment.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Model class for comments
class Comment < ApplicationRecord
belongs_to :discussion
Expand All @@ -13,7 +15,6 @@ class Comment < ApplicationRecord
validates :author_type, presence: true
validates :user_id, presence: true, if: -> { author_type == 'authenticated'}

# Without a comment on this line, Rubocop fails the line below o.O
validates :number, uniqueness: { scope: :discussion_id }

validates :body, presence: true, unless: -> { title.present? }
Expand Down
6 changes: 3 additions & 3 deletions app/models/setting_value.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

# Model class for setting values (site-wide and per-user config settings)
class SettingValue < ApplicationRecord
validates :setting_id, presence: true

# Without a comment on this line, Rubocop fails the line below o.O
validates :user_id, uniqueness: {
validates :user_id, uniqueness: {
scope: :setting,
message: I18n.t( 'models.setting_value.one_per_user' )
}
Expand Down

0 comments on commit a0c1a2a

Please sign in to comment.