username_suggester 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/lib/username_suggester/suggestions_for.rb +2 -2
- data/username_suggester.gemspec +1 -1
- metadata +3 -3
data/.gitignore
CHANGED
@@ -26,11 +26,11 @@ module UsernameSuggester
|
|
26
26
|
num_suggestions = options[:num_suggestions] || 10
|
27
27
|
|
28
28
|
send :define_method, "#{attribute}_suggestions".to_sym do
|
29
|
-
suggester = Suggester.new(
|
29
|
+
suggester = Suggester.new(send(first_name_attribute), send(last_name_attribute), options)
|
30
30
|
name_combinations_with_regex = suggester.name_combinations.map { |s| "^#{s}[0-9]*$" }
|
31
31
|
sql_conditions = Array.new(name_combinations_with_regex.size, "#{attribute} RLIKE ?").join(" OR ")
|
32
32
|
unavailable_choices = self.class.all(:select => attribute,
|
33
|
-
:conditions => [sql_conditions].concat(name_combinations_with_regex)).map{ |c| c.
|
33
|
+
:conditions => [sql_conditions].concat(name_combinations_with_regex)).map{ |c| c.send(attribute) }
|
34
34
|
suggester.suggest(num_suggestions, unavailable_choices)
|
35
35
|
end
|
36
36
|
end
|
data/username_suggester.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: username_suggester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- jerryluk
|