Created
February 1, 2010 04:36
-
-
Save bouchard/291455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 67375bb902354b41bf99cb3ffbb9b4864c86e139 Mon Sep 17 00:00:00 2001 | |
From: Brady Bouchard <[email protected]> | |
Date: Mon, 1 Feb 2010 14:24:13 +1000 | |
Subject: [PATCH] Added an option to force all tags to lowercase. | |
Use: | |
Put | |
TagList.force_lowercase = true | |
in environment.rb | |
--- | |
lib/acts_as_taggable_on/tag_list.rb | 4 +++- | |
1 files changed, 3 insertions(+), 1 deletions(-) | |
diff --git a/lib/acts_as_taggable_on/tag_list.rb b/lib/acts_as_taggable_on/tag_list.rb | |
index b064adb..3c40709 100644 | |
--- a/lib/acts_as_taggable_on/tag_list.rb | |
+++ b/lib/acts_as_taggable_on/tag_list.rb | |
@@ -1,6 +1,7 @@ | |
class TagList < Array | |
- cattr_accessor :delimiter | |
+ cattr_accessor :delimiter, :force_lowercase | |
self.delimiter = ',' | |
+ self.force_lowercase = false | |
def initialize(*args) | |
add(*args) | |
@@ -54,6 +55,7 @@ class TagList < Array | |
def clean! | |
reject!(&:blank?) | |
map!(&:strip) | |
+ map!(&:downcase) if force_lowercase | |
uniq! | |
end | |
-- | |
1.6.4.rc3.12.gdf73a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment