Has_friendly_name is a project mainly written in Ruby, based on the MIT license.
HasFriendlyName adds a search engine friendly name to your active record model.
HasFriendlyName adds a search engine friendly name to your active record model. It also extends the String class with a "to_friendly" method
add the following to your config/enviroment.rb
config.gem "has_friendly_name"
If your user model has a name method and you want an unique friendly_name just use:
class User < ActiveRecord::Base
has_friendly_name
end
first record with name myStylish~Name gets the following friendly_name: mystylish-name
the second record with the same name gets the following friendly_name: mystylish-name-2
HasFriendlyName comes with serveal configuration options:
class User < ActiveRecord::Base
has_friendly_name(:unique => false, :from => :title, :downcase => false, :titelize => true, :seperator => "_")
end
first record with name myStylish~Name gets the following friendly_name: MyStylish_Name
the second record with the same name gets the same because unique is false
Copyright (c) 2010 Dennis Meise , released under the MIT license