No commit activity in last 3 years
No release in over 3 years
Generates username suggestions for users
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9
~> 2.11.0
~> 1.3.6
 Project Readme

TODO: Rewrite the readme at it’s soooo old :(¶ ↑

UsernameSuggester¶ ↑

It generates username suggestions for users. It works with MySQL and any DB that supports “RLIKE”. If enough people request, I will add the support for not using RLIKE for those DB does not support it. (although it will be slower)

Usage¶ ↑

In your environment.rb, add:

config.gem 'username_suggester'

Assume you have an User model with attributes :username, :firstname, :lastname

class User < ActiveRecord::Base
  suggestions_for :username, :num_suggestions => 5,
    :first_name_attribute => :firstname, :last_name_attribute => lastname

  ...

end

And now you can call the suggestion function like the following:

user = User.new(:firstname => "Jerry", :lastname => "Luk")
user.username_suggestions

You can also filter the suggestions, let’s say you want the username to contain at least 4 characters:

suggestions_for :username, :num_suggestions => 10,
  :validate => Proc.new { |username| username.length >= 4 }

Copyright © 2010 Presdo, released under the MIT license