We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a1bece commit edc41e6Copy full SHA for edc41e6
app/models/news.rb
@@ -1,3 +1,9 @@
1
class News < ApplicationRecord
2
scope :recent, -> { order(published_at: :desc) }
3
+
4
+ validates :title, presence: true
5
+ validates :url, presence: true,
6
+ uniqueness: true,
7
+ format: { with: /\Ahttps?:\/\/.*\z/i }
8
+ validates :published_at, presence: true
9
end
0 commit comments