Order budgets by created_at instead of by id
This is a preventive change which will be useful once the rake to migrate from `spending_proposals` to `budget_investments` is complete As after running that migration, old `spending_proposal` budgets will have a newer `id` than the existing budgets. And therefore the last budget will be one of those migrated from the old `spending_proposal` model By ordering by `created_at` and probably updating the `created_at` attribute in the rake that migrates `spending_proposals` to `budget_investments`, we will have a coherent order for budgets
This commit is contained in:
@@ -33,7 +33,7 @@ class Budget < ActiveRecord::Base
|
||||
scope :open, -> { where.not(phase: "finished") }
|
||||
|
||||
def self.current
|
||||
where.not(phase: "drafting").last
|
||||
where.not(phase: "drafting").order(:created_at).last
|
||||
end
|
||||
|
||||
def description
|
||||
|
||||
Reference in New Issue
Block a user