mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-04-20 07:11:33 +02:00
Add paper validation tests
This commit is contained in:
parent
3b4f158ea5
commit
d5849c2bea
3 changed files with 19 additions and 4 deletions
|
@ -5,8 +5,7 @@ class Paper < ActiveRecord::Base
|
|||
include Elasticsearch::Model
|
||||
include Elasticsearch::Model::Callbacks
|
||||
|
||||
validates_presence_of :body, :content, :name, :originator, :paper_type, :reference, :url
|
||||
validates_presence_of :published_at, allow_nil: true
|
||||
validates_presence_of :body, :content, :name , :originator, :paper_type, :reference, :url, :published_at
|
||||
validates :url, uniqueness: true
|
||||
|
||||
settings index: { number_of_shards: 1 } do
|
||||
|
@ -17,7 +16,7 @@ class Paper < ActiveRecord::Base
|
|||
indexes :paper_type, type: :string, index: :not_analyzed
|
||||
indexes :originator, type: :string, index: :not_analyzed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def split_originator
|
||||
originator.split(/\d\.\s/).reject {|s| s.blank?} || originator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue