Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Remove default value try2 #22923

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace default_value_for with simple fetch defaults
jrafanie committed Feb 29, 2024
commit 760f8df3f0d7619de97b3fcee604673d99cceef7
6 changes: 2 additions & 4 deletions app/models/time_profile.rb
Original file line number Diff line number Diff line change
@@ -4,8 +4,6 @@ class TimeProfile < ApplicationRecord
DEFAULT_TZ = "UTC".freeze

serialize :profile
default_value_for :days, ALL_DAYS
default_value_for :hours, ALL_HOURS

has_many :miq_reports
has_many :metric_rollups
@@ -75,7 +73,7 @@ def tz_or_default(default_tz = DEFAULT_TZ)
end

def days
profile[:days]
profile.fetch(:days, ALL_DAYS)
end

def days=(arr)
@@ -85,7 +83,7 @@ def days=(arr)
end

def hours
profile[:hours]
profile.fetch(:hours, ALL_HOURS)
end

def hours=(arr)