# Rails 1.2 Bug (?): to\_text\_area\_tag

**URL:** <https://www.ruby-forum.com/t/rails-1-2-bug-to-text-area-tag/87099>\
**Category:** Rails\
**Created:** [February 28, 2007, 4:51am UTC](https://www.ruby-forum.com/t/rails-1-2-bug-to-text-area-tag/87099 "2007-02-28T04:51:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brendon\_Davidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/45deac/32.png) [@Brendon\_Davidson](https://www.ruby-forum.com/u/Brendon_Davidson)\
**Post date:** [February 28, 2007, 4:51am UTC](https://www.ruby-forum.com/t/rails-1-2-bug-to-text-area-tag/87099/1 "2007-02-28T04:51:07Z")

</div>

Hi all,

I’m fairly new to rails and thus might be missing something here, but I  
think I have found a but in ActionPack. If this is not the right place  
to post this, please let me know where. I discovered this issue while  
attempting to use the lastest edge version of ajax\_scaffold (mooey, MUI,  
whatever it’s going to be called). I kept getting the error:

private method `split’ called for 20:Fixnum

Curious as to what was going on, I decided to delve into the code a bit.  
I found that mooey was calling the input(…) form helper to generate  
the input fields for models and sends in the option :size =\> 20. input  
then calls to\_text\_area\_tag. Well, since :size is a Fixnum and  
to\_text\_area\_tag expects it to be a string, we get the above noted  
error.

This does not appear to be an error with the mooey code, however, since  
input(…) seems to be intended to dynamically create the correct tag  
depending on the “method” type. Therefore, if the method being used  
with input(…) was a string, it would call to\_text\_input\_tag which  
assumes that :size is a Fixnum and everything would be alright.

What I did next was to change to\_text\_area\_tag to recognize detect if  
:size was a Fixnum. If it is, simply set both :options[“rows”] and  
:options[“cols”] to the value of :size. Otherwise, use the original  
logic to split the string and determine the cols/rows.

I hope this is clear and helps somewhat. I’m not sure that this is the  
proper solution, but it does seem to be a legitimate issue. Below is  
the code for my new to\_text\_area\_tag:

```
  def to_text_area_tag(options = {})
    options =

```

DEFAULT\_TEXT\_AREA\_OPTIONS.merge(options.stringify\_keys)  
add\_default\_name\_and\_id(options)

```
    if size = options.delete("size")
      if size.kind_of? Fixnum
        options["cols"] = size
        options["rows"] = size
      else
        options["cols"], options["rows"] = size.split("x")
      end
    end

    content_tag("textarea", html_escape(options.delete('value') ||

```

value\_before\_type\_cast(object)), options)  
end

Now that I’ve gotten that out of the way, I must say that rails is  
AWESOME!! I’m able to develop real working apps so much quicker than  
I’ve ever done in php or java. Great stuff! Keep up the good work.

Brendon Davidson

---

<div class="post-metadata">

**Author:** ![Brendon\_Davidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/45deac/32.png) [@Brendon\_Davidson](https://www.ruby-forum.com/u/Brendon_Davidson)\
**Post date:** [February 28, 2007, 4:54am UTC](https://www.ruby-forum.com/t/rails-1-2-bug-to-text-area-tag/87099/2 "2007-02-28T04:54:09Z")

</div>

> This does not appear to be an error with the mooey code, however, since  
> input(…) seems to be intended to dynamically create the correct tag  
> depending on the “method” type. Therefore, if the method being used  
> with input(…) was a string, it would call to\_text\_input\_tag which  
> assumes that :size is a Fixnum and everything would be alright.

I actually meant to\_input\_field\_tag. to\_text\_input\_tag does not exist.

Brendon Davidson
