Forum: Ruby on Rails FormOptionsHelper select call failing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Pete Y. (Guest)
on 2005-11-15 08:15
(Received via mailing list)
In Rails 0.14.3, I'm doing the following in a view:

     <%= select 'folder', 'format', ['a', 'b', 'c'] %>

This line in is failing with:

     ActionView::TemplateError (too few arguments.)

Am I calling select incorrectly? (Yes, the @folder object does exist,
and does have an attribute named 'format'.) My reading of the
options_for_select documentation says this should work. Am I missing
something, or should I file a bug?

Replacing ['a', 'b', 'c'] with [['a', 'a'], ['b', 'b'], ['c', 'c']]
generates the same error.

The stack trace looks like this:

     /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/
action_view/helpers/form_helper.rb:247:in `format'
     /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/
action_view/helpers/form_helper.rb:247:in `send'
     /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/
action_view/helpers/form_helper.rb:247:in `value'
     /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/
action_view/helpers/form_options_helper.rb:299:in `to_select_tag'
     /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/
action_view/helpers/form_options_helper.rb:63:in `select'
     #{RAILS_ROOT}/app/views/folder/new.rhtml:13


Cheers,

Pete Y.
s.j.coombes (Guest)
on 2005-11-15 17:24
(Received via mailing list)
Pete Y. <pete@...> writes:

> and does have an attribute named 'format'.) My reading of the
> options_for_select documentation says this should work. Am I missing
> something, or should I file a bug?
>
> Replacing ['a', 'b', 'c'] with [['a', 'a'], ['b', 'b'], ['c', 'c']]
> generates the same error.

> Cheers,
>
> Pete Y.
>

I copied your tag to one of my views, changed the object and attribute
names,
and yes, it works.

I'm using Rails v 0.14.2.

I'm afraid I don't know enough about Rails to say what the problem might
be,
but I don't think it is the select tag.

regards

Steve
Pete Y. (Guest)
on 2005-11-16 02:35
(Received via mailing list)
Hmmm, alright, I'll break it out and see if I can make a simple app
that demonstrates the bug. Thanks.
This topic is locked and can not be replied to.