Force processes order

This commit is contained in:
Amaia Castro
2016-12-28 19:07:06 +01:00
parent bbcf5aa0f4
commit 5b3dcd7886
2 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
load_and_authorize_resource :process, class: "Legislation::Process"
def index
@processes = ::Legislation::Process.send(@current_filter).page(params[:page])
@processes = ::Legislation::Process.send(@current_filter).order('id DESC').page(params[:page])
end
def create

View File

@@ -19,9 +19,9 @@ class Legislation::Process < ActiveRecord::Base
validates :allegations_end_date, presence: true
validates :final_publication_date, presence: true
scope :open, -> {where("start_date <= ? and end_date >= ?", Date.current, Date.current) }
scope :next, -> {where("start_date > ?", Date.current) }
scope :past, -> {where("end_date < ?", Date.current) }
scope :open, -> { where("start_date <= ? and end_date >= ?", Date.current, Date.current).order('id DESC') }
scope :next, -> { where("start_date > ?", Date.current).order('id DESC') }
scope :past, -> { where("end_date < ?", Date.current).order('id DESC') }
def open_phase?(phase)
today = Date.current