def categories_select(name, collection, options = {})
      options = {
        disable_parents: true
      }.merge(options)

      disable_parents = options[:disable_parents]

      selected = object.send(name)
      categories = categories_for_select(collection)
      disabled = if disable_parents
                   disabled_categories_for(collection)
                 else
                   []
                 end
      html_options = {}

      select(name, @template.options_for_select(categories, selected: selected, disabled: disabled), options, html_options)
    end
def categories_select(name, collection, options = {})
      options = {
        disable_parents: true
      }.merge(options)

      disable_parents = options[:disable_parents]

      selected = object.send(name)
      categories = categories_for_select(collection)
      disabled = if disable_parents
                   disabled_categories_for(collection)
                 else
                   []
                 end
      html_options = {}

      select(name, @template.options_for_select(categories, selected: selected, disabled: disabled), options, html_options)
    end
Public: Generates a select field with the categories. Only leaf categories can be set as selected.

 name       - The name of the field (usually category_id)
 collection - A collection of categories.
 options    - An optional Hash with options:
 - prompt   - An optional String with the text to display as prompt.
 - disable_parents - A Boolean to disable parent categories. Defaults to `true`.

 Returns a String.