README.rdoc in username_suggester-0.1.0 vs README.rdoc in username_suggester-0.2.0
- old
+ new
@@ -4,10 +4,13 @@
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
@@ -19,10 +22,10 @@
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 contains at least 4 characters:
+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 }