I know there are various plugins (i have my own as well) for creating
permalinks for clean URLs. I'm curious to know what the core team thinks
about including such a feature into rails core or if this is something
the core believes should remain a plugin?
We have dasherizer, camelize, etc. and thought it would be nice to have
a "permalizer" as well. What are your thoughts?
I ask because I have my own that I've been using and was thinking about
submitting it as a patch, but wanted to get some feedback before
pursuing it. Here's the basics of it to help generate some further
discussion:
require 'iconv'
module Permalizer
def permalize!
permalink!(self)
end
def permalize
string = self.dup
permalink!(string)
end
def permalink!(word)
(Iconv.new('US-ASCII//TRANSLIT', 'utf-8').iconv
word).gsub(/[^\w\s\-\—]/,'').gsub(/[^\w]|[\_]/,'
').split.join('-').downcase
end
end
We have dasherizer, camelize, etc. and thought it would be nice to have
a "permalizer" as well. What are your thoughts?
I don't think it's something that belongs in core. There are so many
different requirements as to how people want word-based URLs to look
like that it doesn't feel like we stand to gain much by standardizing.