lib/has_slug.rb
# has_slug takes an arbitrary number of Symbols as arguments. Those
# should be methods (i.e. ActiveRecord attributes) of your model which
# return strings to be slugalized.
# E.g. has_slug(:title)
# or   has_slug(:category, :short_title)
has_slug takes an arbitrary number of Symbols as arguments. Those
should be methods  of your model which
return strings to be slugalized.
has_slug takes an arbitrary number of Symbols as arguments . Those should be methods of your model which return strings to be slugalized .
def has_slug(*parts)
          self.class_eval <<-EOR
            def to_param
              p = self.id.to_s
              #{parts.collect { |part| 'p += "-#{(self.' + part.to_s + ').parameterize}" unless self.' + part.to_s + '.blank?'+"\n"}}
              p
            end
            # Checks if a given string equals self.to_param
            def check_slug(slug)
              slug == self.to_param
            end
          EOR
        end
def has_slug ( * parts ) self . class_eval <<-EOR 
            def to_param
              p = self.id.to_s
               #{ parts . collect { | part | 'p += "-#{(self.' + part . to_s + ').parameterize}" unless self.' + part . to_s + '.blank?' + "\n" } } 
              p
            end

            # Checks if a given string equals self.to_param
            def check_slug(slug)
              slug == self.to_param
            end
           EOR end
has_slug takes an arbitrary number of Symbols as arguments.
has_slug takes an arbitrary number of Symbols as arguments .
# Ouch, that's not pretty! Any beautification ideas?
parts
<not_specific>