1
我有一個server_form迭代這裏我把class: 'form-control'
它工作正常,除了最後一次迭代與|spec_fields|
Rails的表單生成器 - 怎樣把HTML屬性
= form_for @server do |server_form|
= server_form.label :hostname
= server_form.text_field :hostname, class: 'form-control'
= server_form.label :description
= server_form.text_field :description, class: 'form-control'
= server_form.fields_for :spec do |spec_fields|
Count of CPUs : #{spec_fields.text_field :cpucount}
RAM (GB): #{spec_fields.text_field :ram_gb}
HD (GB): #{spec_fields.text_field :hd_gb}
HD used (GB): #{spec_fields.text_field :hdused_gb}
我的問題是:我怎樣才能把form-control
類也爲|spec_fields|