simplified regexps

This commit is contained in:
albert
2010-02-12 18:52:16 -05:00
parent 661c214094
commit caa7d8ef05
3 changed files with 4 additions and 4 deletions

View File

@@ -225,7 +225,7 @@ class Post < ActiveRecord::Base
end
def remove_favorite(user)
self.fav_string.gsub!(/fav:#{user.name}\b\s*/, " ")
self.fav_string.gsub!(/(?:\A| )fav:#{user.name}(?:\Z| )/, " ")
self.fav_string.strip!
Favorite.destroy(user, self)
end
@@ -454,7 +454,7 @@ class Post < ActiveRecord::Base
end
def remove_pool(pool)
self.pool_string.gsub!(/pool:#{pool.name}\b\s*/, " ")
self.pool_string.gsub!(/(?:\A| )pool:#{pool.name}(?:\Z| )/, " ")
self.pool_string.strip!
end
end