lib/formtastic/inputs/select_input.rb in formtastic-2.1.1 vs lib/formtastic/inputs/select_input.rb in formtastic-2.2.0.rc
- old
+ new
@@ -15,11 +15,11 @@
# The flexibility of the `:collection` option (see examples) makes the :select input viable as
# an alternative for many other input types. For example, instead of...
#
# * a `:string` input (where you want to force the user to choose from a few specific strings rather than entering anything)
# * a `:boolean` checkbox input (where the user could choose yes or no, rather than checking a box)
- # * a `:date`, `:time` or `:datetime` input (where the user could choose from pre-selected dates)
+ # * a `:date_select`, `:time_select` or `:datetime_select` input (where the user could choose from pre-selected dates)
# * a `:number` input (where the user could choose from a set of pre-defined numbers)
# * a `:time_zone` input (where you want to provide your own set of choices instead of relying on Rails)
# * a `:country` input (no need for a plugin really)
#
# Within the standard `<li>` wrapper, the output is a `<label>` tag followed by a `<select>`
@@ -130,13 +130,10 @@
# <%= f.input :author, :as => :select, :prompt => false %>
# <%= f.input :author, :as => :select, :prompt => true %> => <option value="">Please select</option>
# <%= f.input :author, :as => :select, :prompt => "Please select an author" %>
#
#
- # @example Group options an `<optgroup>` with the `:group_by` and `:group_label` options (`belongs_to` associations only)
- # <%= f.input :author, :as => :select, :group_by => :continent %>
- #
# @see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documentation of all possible options.
# @see Formtastic::Inputs::CheckBoxesInput CheckBoxesInput as an alternative for `has_many` and `has_and_belongs_to_many` associations
# @see Formtastic::Inputs::RadioInput RadioInput as an alternative for `belongs_to` associations
#
# @todo Do/can we support the per-item HTML options like RadioInput?
@@ -193,10 +190,10 @@
def input_options
super.merge :include_blank => (include_blank unless prompt?)
end
def input_html_options
- extra_input_html_options.merge(super)
+ extra_input_html_options.merge(super.reject {|k,v| k==:name && v.nil?} )
end
def extra_input_html_options
{
:multiple => multiple?,
\ No newline at end of file