small medium large xlarge

Mittelalter_002_pragsmall
20 Mar 2009, 13:57
Philipp Ringli (6 posts)

If I use @chars.length@ I get the following error: undefined method `length’ for # Extracted source (around line #9):

6:     <tr> 
7:         <td><%=h person.name %></td> 
8:         <td><%= person.name.length %></td>
9:         <td><%= person.name.chars.length %></td> 
10:         <td><%=h person.name.chars.reverse %></td>
11:     </tr> 
12:     <% end %> 

</code>

Using @person.name.mb_chars.length@ works. @chars.reverse@ has the same problem, same error.

I am running Rails 2.3.2 and Ruby 1.8.7.

Can anyone explain?

Samr_small_pragsmall
20 Mar 2009, 20:36
Sam Ruby (634 posts)

I’ve added this to the “changes”:http://pragprog.wikidot.com/changes-in-rails-2-3 page… Thanks!

You must be logged in to comment