mirror of
https://github.com/danbee/slugtastic
synced 2025-03-04 08:49:05 +00:00
Fixed minor bug when the source field is empty.
This commit is contained in:
parent
fc2071e13e
commit
c6207af494
2
Rakefile
2
Rakefile
@ -2,7 +2,7 @@ require 'rubygems'
|
||||
require 'rake'
|
||||
require 'echoe'
|
||||
|
||||
Echoe.new('slugtastic', '0.1.1') do |p|
|
||||
Echoe.new('slugtastic', '0.1.2') do |p|
|
||||
p.description = "A simple slug string generator for ActiveRecord. Will populate a slug attribute from another attribute."
|
||||
p.url = "http://github.com/danbee/slugtastic"
|
||||
p.author = "Dan Barber"
|
||||
|
||||
@ -4,7 +4,7 @@ module Slugtastic
|
||||
end
|
||||
|
||||
def generate_slug(string)
|
||||
string.downcase.gsub(/ /, '_').gsub(/[^a-z0-9\-_]/, '')
|
||||
string.downcase.gsub(/ /, '_').gsub(/[^a-z0-9\-_]/, '') unless string.nil?
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{slugtastic}
|
||||
s.version = "0.1.1"
|
||||
s.version = "0.1.2"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = [%q{Dan Barber}]
|
||||
s.date = %q{2011-10-04}
|
||||
s.date = %q{2011-10-08}
|
||||
s.description = %q{A simple slug string generator for ActiveRecord. Will populate a slug attribute from another attribute.}
|
||||
s.email = %q{danbee@gmail.com}
|
||||
s.extra_rdoc_files = [%q{README.md}, %q{lib/slugtastic.rb}]
|
||||
s.files = [%q{README.md}, %q{Rakefile}, %q{lib/slugtastic.rb}, %q{Manifest}, %q{slugtastic.gemspec}]
|
||||
s.files = [%q{Manifest}, %q{README.md}, %q{Rakefile}, %q{lib/slugtastic.rb}, %q{slugtastic.gemspec}]
|
||||
s.homepage = %q{http://github.com/danbee/slugtastic}
|
||||
s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Slugtastic}, %q{--main}, %q{README.md}]
|
||||
s.require_paths = [%q{lib}]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user