2014-08-30 88 views

回答

1
:input_html => { :value => "#{@description.try(:title)}" } 

你也可以写类似:description.title if description

但它看起来像你正在使用simple_form宝石,在这种情况下,像f.input :description, input_html: { class: 'special' }如果存在应自动设定值。

+0

不错的一个!谢谢 – bootsa 2014-08-30 12:29:22