diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index e2dc790ee..ca9a18d0c 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -181,7 +181,7 @@ module Budgets end def load_map - @map_location = MapLocation.load_from_heading(@heading) if @heading.present? + @map_location = MapLocation.from_heading(@heading) if @heading.present? end end end diff --git a/app/models/map_location.rb b/app/models/map_location.rb index 3ab33af42..6ed4fc9cc 100644 --- a/app/models/map_location.rb +++ b/app/models/map_location.rb @@ -17,11 +17,11 @@ class MapLocation < ApplicationRecord } end - def self.load_from_heading(heading) - map = new - map.zoom = Budget::Heading::OSM_DISTRICT_LEVEL_ZOOM - map.latitude = heading.latitude.to_f if heading.latitude.present? - map.longitude = heading.longitude.to_f if heading.longitude.present? - map + def self.from_heading(heading) + new( + zoom: Budget::Heading::OSM_DISTRICT_LEVEL_ZOOM, + latitude: (heading.latitude.to_f if heading.latitude.present?), + longitude: (heading.longitude.to_f if heading.longitude.present?) + ) end end