Rails - disable select tag

I am trying to disable the select tag. Parameters for filling our database attributes, not an array of integers, so in this situation the collection_select function does not work.

method 1:

select_tag(:zev_qty, options_for_select(display_quantity(@order_subject_supplies_request.site), {:disabled => display_quantity(@order_subject_supplies_request.site)}))

def display_quantity(site)
  if site
    site.open_site? ? [[0,0],[1,1],[2,2]] : [[0,0],[1,1]]
  else
    []
  end
end

This is not what I want. It disables options, not the select tag.

method 2:

f.select(:zev_qty, display_quantity(@order_subject_supplies_request.site), {:disabled => true})
  def display_quantity(site)
    if site
      site.open_site? ? [0,1,2] : [0,1]
    else
      []
    end
  end

The above does not work. None of the options are disabled.

While the correct values ​​are displayed in the drop-down list in both cases, the select tag is not disabled, and note that in this example I just turned off the true value, but of course I would conditionally disable the select tags.

+5
source share
1 answer

The select method is defined as

f.select(method, choices, options = {}, html_options = {}),

, , , , select.

+12

All Articles