<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">141</assigned-user-id>
  <attachments-count type="integer">0</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-08-20T01:09:22+01:00</created-at>
  <creator-id type="integer">29499</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer">9903</milestone-id>
  <number type="integer">867</number>
  <permalink>undefined-method-length-for-enumerable</permalink>
  <priority type="integer">323</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>actionpack activesupport bug enumerable helper multibyte</tag>
  <title>undefined method `length' for Enumerable when calling truncate method</title>
  <updated-at type="datetime">2009-11-02T10:16:07+00:00</updated-at>
  <user-id type="integer">21240</user-id>
  <user-name>Micah Wedemeyer</user-name>
  <creator-name>Gregor Magdolen</creator-name>
  <assigned-user-name>Michael Koziarski</assigned-user-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
  <milestone-title>2.x</milestone-title>
  <original-body>Hello,
this seems to be a small bug in text_helpers truncate method. When trying to call e.g. truncate('Hello World!', 5, '...') it generates following error:

undefined method `length' for #&lt;Enumerable::Enumerator:0x243a7a4&gt;

Full trace:
@@@
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:44:in `truncate'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:25:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `each'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in `__render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:44:in `render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `each'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:741:in `render_with_no_layout'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:244:in `render_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
#{RAILS_ROOT}/app/controllers/admin/posts_controller.rb:48:in `post_list'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
@@@

It seems changing method to

@@@
def truncate(text, length = 30, truncate_string = &quot;...&quot;)
  if text
    l = length - truncate_string.chars.to_a.length
    chars = text.chars
    (chars.to_a.length &gt; length ? chars.to_a[0...l].to_s + truncate_string : text).to_s
  end
end
@@@

will solve the problem.

My configuration is following:
OS: Mac OS X 10.5
Rails: rails 2.1.0
Ruby: ruby 1.8.7
Application server: mongrel 1.1.5</original-body>
  <latest-body>Hello,
this seems to be a small bug in text_helpers truncate method. When trying to call e.g. truncate('Hello World!', 5, '...') it generates following error:

undefined method `length' for #&lt;Enumerable::Enumerator:0x243a7a4&gt;

Full trace:
@@@
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:44:in `truncate'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:25:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `each'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in `__render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:44:in `render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `each'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:741:in `render_with_no_layout'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:244:in `render_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
#{RAILS_ROOT}/app/controllers/admin/posts_controller.rb:48:in `post_list'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
@@@

It seems changing method to

@@@
def truncate(text, length = 30, truncate_string = &quot;...&quot;)
  if text
    l = length - truncate_string.chars.to_a.length
    chars = text.chars
    (chars.to_a.length &gt; length ? chars.to_a[0...l].to_s + truncate_string : text).to_s
  end
end
@@@

will solve the problem.

My configuration is following:
OS: Mac OS X 10.5
Rails: rails 2.1.0
Ruby: ruby 1.8.7
Application server: mongrel 1.1.5</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Hello,
this seems to be a small bug in text_helpers truncate method. When trying to call e.g. truncate('Hello World!', 5, '...') it generates following error:&lt;/p&gt;

&lt;p&gt;undefined method &lt;code&gt;length' for #&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Full trace:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:44:in `truncate'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:25:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `each'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in `__render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:44:in `render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `each'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:741:in `render_with_no_layout'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:244:in `render_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
#{RAILS_ROOT}/app/controllers/admin/posts_controller.rb:48:in `post_list'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It seems changing method to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
def truncate(text, length = 30, truncate_string = &amp;quot;...&amp;quot;)
  if text
    l = length - truncate_string.chars.to_a.length
    chars = text.chars
    (chars.to_a.length &amp;gt; length ? chars.to_a[0...l].to_s + truncate_string : text).to_s
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will solve the problem.&lt;/p&gt;

&lt;p&gt;My configuration is following:
OS: Mac OS X 10.5
Rails: rails 2.1.0
Ruby: ruby 1.8.7
Application server: mongrel 1.1.5&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hello,
this seems to be a small bug in text_helpers truncate method. When trying to call e.g. truncate('Hello World!', 5, '...') it generates following error:

undefined method `length' for #&lt;Enumerable::Enumerator:0x243a7a4&gt;

Full trace:
@@@
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:44:in `truncate'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:25:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `each'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in `__render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:44:in `render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `each'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:741:in `render_with_no_layout'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:244:in `render_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
#{RAILS_ROOT}/app/controllers/admin/posts_controller.rb:48:in `post_list'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
@@@

It seems changing method to

@@@
def truncate(text, length = 30, truncate_string = &quot;...&quot;)
  if text
    l = length - truncate_string.chars.to_a.length
    chars = text.chars
    (chars.to_a.length &gt; length ? chars.to_a[0...l].to_s + truncate_string : text).to_s
  end
end
@@@

will solve the problem.

My configuration is following: OS: Mac OS X 10.5, Rails: rails 2.1.0, Ruby: ruby 1.8.7, Application server: mongrel 1.1.5</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hello,
this seems to be a small bug in text_helpers truncate method. When trying to call e.g. truncate('Hello World!', 5, '...') it generates following error:&lt;/p&gt;

&lt;p&gt;undefined method &lt;code&gt;length' for #&amp;lt;Enumerable::Enumerator:0x243a7a4&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Full trace:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:44:in `truncate'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:25:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `each'
#{RAILS_ROOT}/app/views/admin/posts/post_list.rhtml:22:in `_run_rhtml_47app47views47admin47posts47post_list46rhtml'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb:260:in `__render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:44:in `render_file'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `each'
#{RAILS_ROOT}/vendor/plugins/theme_support/lib/patches/actionview_ex.rb:24:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:806:in `render_file'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:741:in `render_with_no_layout'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/layout.rb:244:in `render_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render'
#{RAILS_ROOT}/app/controllers/admin/posts_controller.rb:48:in `post_list'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:1095:in `perform_action_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It seems changing method to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
def truncate(text, length = 30, truncate_string = &amp;quot;...&amp;quot;)
  if text
    l = length - truncate_string.chars.to_a.length
    chars = text.chars
    (chars.to_a.length &amp;gt; length ? chars.to_a[0...l].to_s + truncate_string : text).to_s
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will solve the problem.&lt;/p&gt;

&lt;p&gt;My configuration is following: OS: Mac OS X 10.5, Rails: rails 2.1.0, Ruby: ruby 1.8.7, Application server: mongrel 1.1.5&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-20T01:16:19+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-08-20T01:16:19+01:00</updated-at>
      <user-id type="integer">29499</user-id>
      <user-name>Gregor Magdolen</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>If your fix works, make a patch with some tests to verify it. If you don't know where to start, check out: http://rails.lighthouseapp.com/projects/8994/sending-patches</body>
      <body-html>&lt;div&gt;&lt;p&gt;If your fix works, make a patch with some tests to verify it. If you don't know where to start, check out: &lt;a href=&quot;http://rails.lighthouseapp.com/projects/8994/sending-patches&quot;&gt;http://rails.lighthouseapp.com/p...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-23T19:20:50+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-08-23T19:20:50+01:00</updated-at>
      <user-id type="integer">19875</user-id>
      <user-name>Peter Wagenet</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>truncate takes an option hash instead of separate length and omission arguments  See http://www.rubyonrails.org/deprecation for details.</body>
      <body-html>&lt;div&gt;&lt;p&gt;truncate takes an option hash instead of separate length and omission arguments  See &lt;a href=&quot;http://www.rubyonrails.org/deprecation&quot;&gt;http://www.rubyonrails.org/depre...&lt;/a&gt; for details.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-23T22:44:50+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-08-23T22:44:50+01:00</updated-at>
      <user-id type="integer">17783</user-id>
      <user-name>Ronald de Gunst</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>@peter: thanks, im new to ruby and rails and i found bug by &quot;accident&quot;, but i'll try my best to make a patch.

@ronald: can you be more specific? I can't find enough information on site you provided. I also believe I have installed latest stable release of rails (installed via gem)</body>
      <body-html>&lt;div&gt;&lt;p&gt;@peter: thanks, im new to ruby and rails and i found bug by &quot;accident&quot;, but i'll try my best to make a patch.&lt;/p&gt;

&lt;p&gt;@ronald: can you be more specific? I can't find enough information on site you provided. I also believe I have installed latest stable release of rails (installed via gem)&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-23T23:11:34+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-08-23T23:11:34+01:00</updated-at>
      <user-id type="integer">29499</user-id>
      <user-name>Gregor Magdolen</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Gregor, it seems we often run into these sorts of things by accident :) Good luck with the patch. I can take a look at it for you once you get it up. Let me know if you have any difficulties.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Gregor, it seems we often run into these sorts of things by accident :) Good luck with the patch. I can take a look at it for you once you get it up. Let me know if you have any difficulties.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-24T01:53:40+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-08-24T01:53:40+01:00</updated-at>
      <user-id type="integer">19875</user-id>
      <user-name>Peter Wagenet</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Peter, I ran into the same issue but solved the problem by eliminating the calls to the 'chars' function:

@@@ ruby
def truncate(text, length = 30, truncate_string = &quot;...&quot;)
  if text.nil? then return end
  l = length - truncate_string.length
  (text.length &gt; length ? text[0...l] + truncate_string : text).to_s
end
@@@</body>
      <body-html>&lt;div&gt;&lt;p&gt;Peter, I ran into the same issue but solved the problem by
eliminating the calls to the 'chars' function:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
def truncate(text, length = 30, truncate_string = &amp;quot;...&amp;quot;)
  if text.nil? then return end
  l = length - truncate_string.length
  (text.length &amp;gt; length ? text[0...l] + truncate_string : text).to_s
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-28T06:08:53+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-09-28T06:08:58+01:00</updated-at>
      <user-id type="integer">33239</user-id>
      <user-name>Boo Yah</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>@Boo Yah: You'll want to make sure that's the right solution. The chars method is for dealing with Unicode, so removing that call may make the truncate method no longer Unicode safe.</body>
      <body-html>&lt;div&gt;&lt;p&gt;@Boo Yah: You'll want to make sure that's the right solution.
The chars method is for dealing with Unicode, so removing that call
may make the truncate method no longer Unicode safe.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-28T16:32:32+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-09-28T16:32:35+01:00</updated-at>
      <user-id type="integer">19875</user-id>
      <user-name>Peter Wagenet</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Gregor,

The issue is that 1.8.7 ruby introduced it's own chars() method onto the String object, overwriting ActiveSupport's attempts to patch it's own chars() method on there.

I believe if you roll back to ruby 1.8.6, your problem will go away. 

I am unsure if it is fixed in newer versions of rails, I am about to go and update my rails now and make sure it all works on 1.8.6 before I attempt to upgrade ruby again.


regards,
Danial</body>
      <body-html>&lt;div&gt;&lt;p&gt;Gregor,&lt;/p&gt;
&lt;p&gt;The issue is that 1.8.7 ruby introduced it's own chars() method
onto the String object, overwriting ActiveSupport's attempts to
patch it's own chars() method on there.&lt;/p&gt;
&lt;p&gt;I believe if you roll back to ruby 1.8.6, your problem will go
away.&lt;/p&gt;
&lt;p&gt;I am unsure if it is fixed in newer versions of rails, I am
about to go and update my rails now and make sure it all works on
1.8.6 before I attempt to upgrade ruby again.&lt;/p&gt;
&lt;p&gt;regards, Danial&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-30T07:25:22+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-09-30T07:25:24+01:00</updated-at>
      <user-id type="integer">33384</user-id>
      <user-name>tigris</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Edit: looks fixed in current rails

http://github.com/rails/rails/commits/master/actionpack/lib/action_view/helpers/text_helper.rb

09/21/08: Change all calls to String#chars to String#mb_chars.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Edit: looks fixed in current rails&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://github.com/rails/rails/commits/master/actionpack/lib/action_view/helpers/text_helper.rb&quot;&gt;
http://github.com/rails/rails/co...&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;09/21/08: Change all calls to String#chars to
String#mb_chars.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-30T07:35:33+01:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack bug enumerable helper</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-09-30T07:35:35+01:00</updated-at>
      <user-id type="integer">33384</user-id>
      <user-name>tigris</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I can verify this problem. &quot;Hello&quot;.chars is returning an Enumerable::Enumerator on Rails 2.2 RC1 and 2 with ruby 1.8.7. With Rails 2.1.2/Ruby 1.8.7 it worked fine.

Using Ubuntu 8.10 here.

&quot;Hello&quot;.chars.downcase
NoMethodError: undefined method `downcase' for #&lt;Enumerable::Enumerator:0xb6809e84&gt;</body>
      <body-html>&lt;div&gt;&lt;p&gt;I can verify this problem. &quot;Hello&quot;.chars is returning an
Enumerable::Enumerator on Rails 2.2 RC1 and 2 with ruby 1.8.7. With
Rails 2.1.2/Ruby 1.8.7 it worked fine.&lt;/p&gt;
&lt;p&gt;Using Ubuntu 8.10 here.&lt;/p&gt;
&lt;p&gt;&quot;Hello&quot;.chars.downcase NoMethodError: undefined method
&lt;code&gt;downcase' for
#&amp;lt;Enumerable::Enumerator:0xb6809e84&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-11-15T23:21:42+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: actionpack bug enumerable helper
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-11-15T23:21:48+00:00</updated-at>
      <user-id type="integer">18453</user-id>
      <user-name>iGEL</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>After 2 hours of searching for a bug in Rails, I've realized, that I've should have read tigris completely. Sorry...</body>
      <body-html>&lt;div&gt;&lt;p&gt;After 2 hours of searching for a bug in Rails, I've realized,
that I've should have read tigris completely. Sorry...&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-11-16T00:12:14+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-11-16T00:12:20+00:00</updated-at>
      <user-id type="integer">18453</user-id>
      <user-name>iGEL</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">141</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-11-16T20:42:59+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-11-16T20:43:05+00:00</updated-at>
      <user-id type="integer">83</user-id>
      <user-name>DHH</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name>Michael Koziarski</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">141</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>2.1.x doesn't support ruby 1.8.7.

Either downgrade to 1.8.6 or upgrade rails to 2.2 RC2</body>
      <body-html>&lt;div&gt;&lt;p&gt;2.1.x doesn't support ruby 1.8.7.&lt;/p&gt;
&lt;p&gt;Either downgrade to 1.8.6 or upgrade rails to 2.2 RC2&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-11-17T13:29:47+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>resolved</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-11-17T13:29:53+00:00</updated-at>
      <user-id type="integer">141</user-id>
      <user-name>Michael Koziarski</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name>Michael Koziarski</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">141</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Can this not be solved (albeit hackishly) by dropping the following into an initializer?

@@@ ruby
class String
  def chars
    ActiveSupport::Multibyte::Chars.new(self)
  end
  alias_method :mb_chars, :chars
end
@@@

I'm using that trick to get Mephisto + Rails v2.0.5 running under 1.8.7.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Can this not be solved (albeit hackishly) by dropping the
following into an initializer?&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
class String
  def chars
    ActiveSupport::Multibyte::Chars.new(self)
  end
  alias_method :mb_chars, :chars
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm using that trick to get Mephisto + Rails v2.0.5 running
under 1.8.7.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-11-25T07:11:36+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>resolved</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2008-11-25T07:11:38+00:00</updated-at>
      <user-id type="integer">35715</user-id>
      <user-name>Nathan de Vries</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name>Michael Koziarski</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">141</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Nathan, I could kiss you. Your little snippet was enough to get me up and running while I search for a way to migrate a legacy app to something new.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Nathan, I could kiss you. Your little snippet was enough to get
me up and running while I search for a way to migrate a legacy app
to something new.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-11-02T10:16:04+00:00</created-at>
      <creator-id type="integer">29499</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">867</number>
      <permalink>undefined-method-length-for-enumerable</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>resolved</state>
      <tag>actionpack activesupport bug enumerable helper multibyte</tag>
      <title>undefined method `length' for Enumerable when calling truncate method</title>
      <updated-at type="datetime">2009-11-02T10:16:07+00:00</updated-at>
      <user-id type="integer">21240</user-id>
      <user-name>Micah Wedemeyer</user-name>
      <creator-name>Gregor Magdolen</creator-name>
      <assigned-user-name>Michael Koziarski</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/867</url>
      <milestone-title>2.x</milestone-title>
    </version>
  </versions>
</ticket>
