Module: HasPermalink::InstanceMethods

Includes:
FriendlyUrl
Defined in:
lib/has_permalink.rb

Instance Method Summary collapse

Methods included from FriendlyUrl

#normalize

Instance Method Details

Generate permalink for the instance if the permalink is empty or nil.



37
38
39
# File 'lib/has_permalink.rb', line 37

def generate_permalink
  self.permalink = fix_duplication(normalize(self.send(generate_from))) if permalink.blank?
end

#generate_permalink!Object

Generate permalink for the instance and overwrite any existing value.



42
43
44
# File 'lib/has_permalink.rb', line 42

def generate_permalink!
  self.permalink = fix_duplication(normalize(self.send(generate_from)))
end

#to_paramObject

Override to send permalink as params



47
48
49
# File 'lib/has_permalink.rb', line 47

def to_param
  permalink
end