Browse files

also escaping {}

  • Loading branch information...
1 parent 06e061a commit 38302bf2adcd44365ddd9c61726be4075e41d9c7 @jasondew committed Sep 10, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/data_table/mongoid.rb
  2. +1 −1 spec/mongoid_data_table_spec.rb
View
2 lib/data_table/mongoid.rb
@@ -34,7 +34,7 @@ def _order_by_fields params, fields
end
def _sanitize string
- string.strip.gsub(/([\^\\\/\.\+\*\?\|\[\]\(\)\$])/) { "\\#{$1}" }
+ string.strip.gsub(/([\^\\\/\.\+\*\?\|\[\]\(\)\{\}\$])/) { "\\#{$1}" }
end
end
end
View
2 spec/mongoid_data_table_spec.rb
@@ -58,7 +58,7 @@
context "#_sanitize" do
it "should escape characters for the regex" do
- send(:_sanitize, " ^\\/.+*?|[]()$ ").should == "\\^\\\\\\/\\.\\+\\*\\?\\|\\[\\]\\(\\)\\$"
+ send(:_sanitize, " ^\\/.+*?|[](){}$ ").should == "\\^\\\\\\/\\.\\+\\*\\?\\|\\[\\]\\(\\)\\{\\}\\$"
end
end

0 comments on commit 38302bf

Please sign in to comment.