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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---