Как мы можем использовать f.select тег для сбора статической хэш-значенияКак использовать f.select для статического значения хэша?
class ReceiptPrinter
RECEIPT_PRINTER_TYPES ={
0=> "Normal",
1=> "Dot Matrix",
2=> "Thermal",
}
def initialize(options={})
@receipt_printer_type=options[:receipt_printer_type] || DEFAULT_VALUES[:ReceiptPrinterType]
@receipt_printer_header_height=options[:receipt_printer_header_height]|| DEFAULT_VALUES[:ReceiptPrinterHeaderHeight]
@receipt_printer_header_type=options[:receipt_printer_header_type]|| DEFAULT_VALUES[:ReceiptPrinterHeaderType]
@receipt_printer_template=options[:receipt_printer_template]|| DEFAULT_VALUES[:ReceiptPrinterTemplate]
# define_methods()
end
end
В моей странице просмотра я использовал выберите опцию
<% form_for @receipt_printer, :url => { :action => "fees_receipt_settings" } do |f| %>
<%= f.select("receipt_printer_template", @settings.map{| item| [item[0],item[1].to_i]},{},{:onchange => "set_template(this.value)"}) %>
<% end %>
я получаю ошибки неверное число аргументов
Что такое содержание '@ settings'? –