Browse Source

Fix name method to allow nil date parameter and default to current time

pull/3054/head
Manny Dinssa 2 weeks ago
parent
commit
c9741078a5
  1. 3
      app/models/organisation.rb

3
app/models/organisation.rb

@ -72,7 +72,8 @@ class Organisation < ApplicationRecord
end
end
def name(date: Time.zone.now)
def name(date: nil)
date ||= Time.zone.now
name_change = organisation_name_changes.visible.find { |change| change.includes_date?(date) }
name_change&.name || read_attribute(:name)
end

Loading…
Cancel
Save