<select> menu from which the user can choose the target record for a
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
:conditionsdeclared on the
sort- whether to sort the array of options. Defaults to no sorting.
optionsis 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”
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.
Edit this page