First post in here, and first time I'm "contributing" to rails, so
please don't slaughter me.

The dual options hash in ActionView::Helpers::FormOptionsHelper is
bugging me. It has one option hash for options on the method itself,
and another option hash for html options, passed directly to the HTML
tag.

f.select :category_id, the_options, {:include_blank => true}, {:class
=> "hello"}

This is bad for two reasons. First of all, it's very un-common (and
not very pretty, either). If you don't have any method-options, you'll
have a pretty silly empty hash as the 3rd argument. Second of all, it
nerfs the usage of with_options on that method. I'd suggest something
like this:

f.select :category_id, the_options, :include_blank => true, :html =>
{:class => "hai"}

Just like e.g. form_for is doing things.

To ensure backwards compability, one could do something like this:

def select(object, method, choices, *args)
  if args.size == 2
    options = args.first
    html_options = args.last
  else
    options = args.first
    html_options = options.delete(:html)
  end
  InstanceTag.new(object, method, self, nil,
options.delete(:object)).to_select_tag(choices, options, html_options)
end

Sounds sensible? Should I make a patch and submit a ticket?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to