Module: PermalinkFor::PrettyImpl

Extended by:
ActiveSupport::Concern
Defined in:
lib/permalink_for/pretty_impl.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#to_paramObject



4
5
6
7
8
9
10
11
# File 'lib/permalink_for/pretty_impl.rb', line 4

def to_param
  return id if new_record?
  target_field_value = send(permalink_configuration[:target_field])
  arr = [id, I18n.transliterate(target_field_value).parameterize]
  arr.delete('')
  arr = arr.reverse if self.class.permalink_configuration[:reverse]
  arr.join('-')
end