A <select> menu from which the user can choose the target record for a belongs_to association.

This is the default input that Rapid uses for belongs_to associations. The menu is constructed using the to_s representation of the records.


  • include-none - whether to include a ‘none’ option (i.e. set the foreign key to null). If this value is not supplied, the default is “true” if the current value is nil; otherwise the default is “false”. One implication of this is that the default may change when the form is re-rendered due to a validation failure. Setting this value explicitly is recommended.
  • blank-message - the message for the ‘none’ option. Defaults to “(No <model-name-human>)”, e.g. “(No Product)”
  • options - an array of records to include in the menu. Defaults to the all the records in the target table that match any :conditions declared on the belongs_to (subject to limit)
  • sort - whether to sort the array of options. Defaults to no sorting.
  • limit - if options is not specified, this limits the number of records. Default: 100
  • text_method - The method to call on each record to get the text for the option. Multiple methods are supported ie “institution.name”

See Also

For situations where there are too many target records to practically include in a menu, <name-one> provides an autocompleter which would be more suitable.

Show Source

Edit this page