Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
Sprit method added.
Browse files Browse the repository at this point in the history
  • Loading branch information
limonka committed Oct 20, 2009
1 parent 60e29cb commit a78fa94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/permalinks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.included(base)
module ClassMethods
def has_permalink(field = :name)
define_method(:to_param) do
"#{id}-#{send(field).to_s.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/, '-').gsub(/(^-)|(-$)/ ,'')
"#{id}-#{send(field).to_s.strip.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/, '-')
end
end
end
Expand Down

1 comment on commit a78fa94

@limonka
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be strip..

Please sign in to comment.