small medium large xlarge

12 Apr 2009, 20:02
Klaus Breyer (1 post)

I try the little example application for the different length of strings in unicode.

In the code from the book on page 288 stands: `

<%=h %></td>

<%= %></td>

<%= %></td>

<%=h %></td> `

but this produces just: ` undefined method length' for #<Enumerable::Enumerator:0x7f75ded33fa0> Extracted source (around line #9): <tr> <td><%= h %></td> <td><%= %></td> <td><%= %></td>

If i switch to mb_chars, like you do in irb-example on starting with 16.9 i got no errors with the following code: ` 7 <td><%= h %></td> 8 <td><%= %></td> 9 <td><%= %></td> 10 <td><%=h %></td> `

whats the difference between mb_chars and chars? The funny thing: there is none. But why the hell i got a Enumable as return?

# File activesupport/lib/active_support/core_ext/string/multibyte.rb, line 57 def chars ActiveSupport::Deprecation.warn('String#chars has been deprecated in favor of String#mb_chars.', caller) mb_chars end

Using the example-setup from the book to confirm the correctness of all examples: Rails 2.2.2 Ruby 1.8 Gems: 1.3.1

on a Ubuntu Linux 8.10 x64

You must be logged in to comment