Method: Perus::Server::Form#select
- Defined in:
- lib/perus/server/form.rb
#select(field, options) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/perus/server/form.rb', line 58 def select(field, ) existing = @record.send(field) option_rows = .collect do |(value, name)| selected = existing == value ? 'selected' : '' "<option value=\"#{escape_quotes(value)}\" #{selected}>#{name || value}</option>" end "<select name=\"record[#{field}]\">#{option_rows.join("\n")}</select>" end |