materialize - Materializecss chips in Rails 4 doesn't save data to db -
i have problem material chips in rails (4.2.6) app. when add class chips-initial input field, can't write data field. field nil. don't understand why. field string, when field array, got same problem.
this form:
= simple_form_for @exemple |f| .input-field = f.input :title .input-field = f.label 'content' = f.text_area :content, class: "materialize-textarea" .input-field.chips.chips.chips-initial.chipschips-placeholder = f.input :tags = f.button :submit, class: 'btn btn-primary'
this .js initial chips
$( document ).ready(function(){ $('.chips-initial').material_chip({ data: [{ tag: 'apple', }, { tag: 'microsoft', }, { tag: 'google', }], placeholder: 'enter tag', secondaryplaceholder: '+tag', } ) });
in html:
<div class="input-field chips chips chips-initial chipschips-placeholder" data-index="0" data-initialized="true"> <div class="chip">apple<i class="material-icons close">close</i></div> <div class="chip">microsoft<i class="material-icons close">close</i></div> <div class="chip">google<i class="material-icons close">close</i></div> <input id="9c3fa6b9-b134-626b-ddbb-a0a12a538eed" class="input" placeholder="enter tag"></div> <input id="9c3fa6b9-b134-626b-ddbb-a0a12a538eed" class="input" placeholder="enter tag">
but when create, in console:
#<example id: 3, title: "", content: "", tags: nil, place: "", date: nil, created_at: "2016-11-04 18:31:50", updated_at: "2016-11-04 18:31:50", image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil
i using gem 'materialize-sass'
Comments
Post a Comment