norman / friendly_id-globalize

Globalize support for FriendlyId
MIT License
66 stars 32 forks source link

updating slugs using self.set_friendly_id t.title, t.locale #2

Open mugwump opened 11 years ago

mugwump commented 11 years ago

I'm using slugged together with friendly_id-globalize on my model:

extend FriendlyId
friendly_id :title, :use => [:globalize, :slugged]

The initial generation of the slug works fine, but when I try to update my slugs when the title has changed with:

    self.translations.each do |t|
      t.slug = self.set_friendly_id t.title, t.locale
    end

I get a:

NoMethodError: undefined method `set_friendly_id'

Is there a better, or at least a working way to handle slug-updates?! I've migrated from an earlier version of friendly_id where this approach worked, but as the docs haven't changed on I assumed that this should still be working...