ruby on rails helpers html5

时间:2017-09-05 03:50:12

标签: html ruby-on-rails ruby form-helpers

<%= form_for(:description, url:{action:'create'}) do |f| %>
    <div class="row">
      <div class="input-field col s6">
        <%= f.text_field :position, data-length:30 %> 
        <label for="position">Position</label>
      </div> 
   </div>
<% end %>

我得到了那个错误,

  

语法错误,意外的keyword_do_block d =(f.text_field:position,   do data-length:30); @ output_buf ^ / home / whitehat / Documents / Books / Web   开发/ Ruby On   轨道/项目/自由职业/敷料店/应用/视图/产品/ new.html.erb:39:   语法错误,意外的tSYMBEG,期待keyword_do或&#39; {&#39;或者&#39;(&#39;   ld:position,do data-length:30); @ output_buffer.safe_appen ^

1 个答案:

答案 0 :(得分:0)

data-length更改为'data-length'

<%= f.text_field :position, 'data-length': 30 %>