【问题标题】:ruby on rails helpers html5ruby on rails helpers html5
【发布时间】:2017-09-05 03:50:11
【问题描述】:
<%= 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, 做数据长度:30);@output_buf ^ /home/whitehat/Documents/Books/Web 开发/Ruby On Rails/Projects/free-lance/dressing-shop/app/views/products/new.html.erb:39: 语法错误,意外的 tSYMBEG,需要关键字_do 或 '{' 或 '(' ld :position, do data-length:30 );@output_buffer.safe_appen ^

【问题讨论】:

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


    【解决方案1】:

    data-length 更改为'data-length'

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

    【讨论】:

    • 不客气。
    猜你喜欢
    • 2015-05-04
    • 1970-01-01
    • 1970-01-01
    • 2012-11-12
    • 1970-01-01
    • 2013-02-24
    • 1970-01-01
    • 2011-04-15
    • 2015-03-02
    相关资源
    最近更新 更多