Skip to content

Commit

Permalink
Update translated slug when saving
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
shioyama committed Aug 5, 2018
1 parent 35c4e6c commit e56a883
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/friendly_id/mobility.rb
Expand Up @@ -52,7 +52,7 @@ def should_generate_new_friendly_id?
def set_slug(normalized_slug = nil)
super
changed.each do |change|
if change =~ /\A#{friendly_id_config.base}_([a-z]{2}(_[a-z]{2})?)/
if change =~ /\A(?:#{friendly_id_config.base}|#{friendly_id_config.slug_column})_([a-z]{2}(_[a-z]{2})?)/
locale, suffix = $1.split('_'.freeze)
locale = "#{locale}-#{suffix.upcase}".freeze if suffix
::Mobility.with_locale(locale) { super }
Expand Down

0 comments on commit e56a883

Please sign in to comment.