Skip to content

Commit

Permalink
Fix cache read twice for a single value (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
qichunren authored Dec 10, 2024
1 parent bd556b0 commit 2969b02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rails-settings/fields/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def default_value
end

def read
return deserialize(default_value) if readonly || saved_value.nil?

deserialize(saved_value)
stored_value = saved_value
return deserialize(default_value) if readonly || stored_value.nil?
deserialize(stored_value)
end

def deserialize(value)
Expand Down

0 comments on commit 2969b02

Please sign in to comment.