Skip to content

Commit 1d0fdd9

Browse files
committed
Write options:nil when options are not specified
1 parent 86d27c5 commit 1d0fdd9

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

app/messages/validators.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ def validate(record)
243243
class OptionsValidator < ActiveModel::Validator
244244
def validate(record)
245245

246-
# Make sure to write an empty hash if options is nil
247-
if record.options.nil?
248-
record.options = {}
249-
end
250-
251246
# Empty option hashes are allowed, so we skip further validation
252247
record.options.blank? && return
253248

db/migrations/20241105000000_add_options_to_route.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Sequel.migration do
22
up do
33
alter_table(:routes) do
4-
add_column :options, String, text: true
4+
add_column :options, String, text: true, default: "{}"
55
end
66
end
77
down do

0 commit comments

Comments
 (0)