Module: Railslove::Plugins::FindByParam::InstanceMethods

Defined in:
lib/find_by_param.rb

Instance Method Summary collapse

Instance Method Details

#to_paramObject


134
135
136
137
138
139
140
141
142
143
144
# File 'lib/find_by_param.rb', line 134

def to_param
  value = self.send(permalink_options[:param]).dup.to_s.downcase rescue ""
  ''.tap do |param|
    if value.blank?
      param << id.to_s
    else
      param << "#{id}-" if permalink_options[:prepend_id]
      param << escape_and_truncate_permalink(value)
    end
  end
end