Sutto / slugged

Super simple slugs for ActiveRecord 3+, with slug history. Formerly known as Pseudocephalopod.
MIT License
86 stars 16 forks source link

For custom source method name x, what to return in x_changed? #15

Closed daehee closed 12 years ago

daehee commented 12 years ago

In my model I've defined a custom method to generate the slug as follows.

  def slugify
    "#{UUID.generate(:compact)}"
  end

and calling it with is_sluggable as follow.

is_sluggable :slugify, :history => false

The gem calls for a slugify_changed? method. What is the proper method definition for this in this example?

Thanks in advance!

Sutto commented 12 years ago

Hey there daehee,

My suggestion is basically to implement slugify_changed? to return false in this case - since the UUI is unique per record, you don't need to regenerate the slug on demand (e.g. when you don't have a cached slug in the first place; it doesn't need to be regenerated else wise).

Let me know how you go with it.