ruby on rails helpers html5

77 Views Asked by At
<%= 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 %>

And I got that error,

syntax error, unexpected keyword_do_block d=( f.text_field :position, do data-length:30 );@output_buf ^ /home/whitehat/Documents/Books/Web development/Ruby On Rails/Projects/free-lance/dressing-shop/app/views/products/new.html.erb:39: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' ld :position, do data-length:30 );@output_buffer.safe_appen ^

1

There are 1 best solutions below

0
On BEST ANSWER

Change data-length to 'data-length':

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