Skip to content

Commit

Permalink
Fix: Set slug before save if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
vfonic committed Dec 23, 2020
1 parent 8e2a1a2 commit 932d4be
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/friendly_id/slugged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def self.included(model_class)
defaults[:sequence_separator] ||= '-'
end
model_class.before_validation :set_slug
model_class.before_save :set_slug
model_class.after_validation :unset_slug_if_invalid
end

Expand Down

0 comments on commit 932d4be

Please sign in to comment.