* Add search_keywords record and associated functionality * Fix test and add badge rewarder method
17 lines
552 B
Ruby
17 lines
552 B
Ruby
class SearchKeyword < ApplicationRecord
|
|
validates :keyword, presence: true
|
|
validates :google_result_path, presence: true
|
|
validates :google_position, presence: true
|
|
validates :google_volume, presence: true
|
|
validates :google_difficulty, presence: true
|
|
validates :google_checked_at, presence: true
|
|
validate :path_format
|
|
|
|
private
|
|
|
|
def path_format
|
|
unless google_result_path&.starts_with?("/") && google_result_path&.count("/") == 2
|
|
errors.add(:google_result_path, "must start with / and be properly formatted")
|
|
end
|
|
end
|
|
end
|