app/models/gallery.rb
# define the permalink with name in downcase
define the permalink with name in downcase
define the permalink with name in downcase
def define_permalink
    unless self.name.nil?
      self.permalink = self.name.downcase.gsub(/[^a-z0-9]+/i, '-')
      change_permalink(self.permalink)
    end
  end
def define_permalink unless self . name . nil? self . permalink = self . name . downcase . gsub ( / [^a-z0-9]+ /i , '-' ) change_permalink ( self . permalink ) end end
define the permalink with name in downcase
define the permalink with name in downcase