Module: ConcernsOnRails::Sluggable

Extended by:
ActiveSupport::Concern
Defined in:
lib/concerns_on_rails/sluggable.rb

Instance Method Summary collapse

Instance Method Details

#slug_sourceObject

Instance methods Returns the source for the slug we are calling the class attribute, so we can use it in the lambda Example:

record.slug_source


53
54
55
56
57
58
59
60
61
# File 'lib/concerns_on_rails/sluggable.rb', line 53

def slug_source
  if self.class.sluggable_field.present? && respond_to?(self.class.sluggable_field)
    send(self.class.sluggable_field)
  elsif respond_to?(:title)
    title
  else
    to_s
  end
end