Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove useless call to mb_chars

  • Loading branch information...
commit 803e9bab84df9a93ca5f4613f710b6e088fbe64b 1 parent 4d08324
Sergey Nartimov lest authored
8 actionpack/lib/action_view/helpers/text_helper.rb
View
@@ -162,15 +162,15 @@ def excerpt(text, phrase, *args)
options.reverse_merge!(:radius => 100, :omission => "...")
phrase = Regexp.escape(phrase)
- return unless found_pos = text.mb_chars =~ /(#{phrase})/i
+ return unless found_pos = text =~ /(#{phrase})/i
start_pos = [ found_pos - options[:radius], 0 ].max
- end_pos = [ [ found_pos + phrase.mb_chars.length + options[:radius] - 1, 0].max, text.mb_chars.length ].min
+ end_pos = [ [ found_pos + phrase.length + options[:radius] - 1, 0].max, text.length ].min
prefix = start_pos > 0 ? options[:omission] : ""
- postfix = end_pos < text.mb_chars.length - 1 ? options[:omission] : ""
+ postfix = end_pos < text.length - 1 ? options[:omission] : ""
- prefix + text.mb_chars[start_pos..end_pos].strip + postfix
+ prefix + text[start_pos..end_pos].strip + postfix
end
# Attempts to pluralize the +singular+ word unless +count+ is 1. If
2  activerecord/lib/active_record/validations/uniqueness.rb
View
@@ -54,7 +54,7 @@ def find_finder_class_for(record) #:nodoc:
def build_relation(klass, table, attribute, value) #:nodoc:
column = klass.columns_hash[attribute.to_s]
- value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s if column.text?
+ value = column.limit ? value.to_s[0, column.limit] : value.to_s if column.text?
if !options[:case_sensitive] && value && column.text?
# will use SQL LOWER function before comparison, unless it detects a case insensitive collation
Please sign in to comment.
Something went wrong with that request. Please try again.