Fix draft versions list

This commit is contained in:
Amaia Castro
2017-01-04 10:13:55 +01:00
parent f040759693
commit 6d99a24740
7 changed files with 16 additions and 13 deletions

View File

@@ -3,7 +3,7 @@ class Legislation::Process < ActiveRecord::Base
include ActsAsParanoidAliases
has_many :draft_versions, -> { order(:id) }, class_name: 'Legislation::DraftVersion', foreign_key: 'legislation_process_id'
has_one :final_draft_version, -> { where final_version: true }, class_name: 'Legislation::DraftVersion', foreign_key: 'legislation_process_id'
has_one :final_draft_version, -> { where final_version: true, status: 'published' }, class_name: 'Legislation::DraftVersion', foreign_key: 'legislation_process_id'
has_many :questions, -> { order(:id) }, class_name: 'Legislation::Question', foreign_key: 'legislation_process_id'
validates :title, presence: true