Skip to content

Commit

Permalink
Avoid unnecessary variable assignment in model slug field abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
ellmetha committed Sep 18, 2024
1 parent 2c60c72 commit 74fcf4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/marten/db/field/slug.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ module Marten

def prepare_save(record, new_record = false)
if slugify?(record.get_field_value(id))
slug = generate_slug(record.get_field_value(slugify.not_nil!).to_s, max_size)
record.set_field_value(id, slug)
record.set_field_value(
id,
generate_slug(record.get_field_value(slugify.not_nil!).to_s, max_size)
)
end
end

Expand Down

0 comments on commit 74fcf4f

Please sign in to comment.