我是一个铁杆新手试图实现依赖领域的宝石。我一直在关注本教程,但一直在学习语法错误。
我是Ruby Haml FYI
https://www.rubydoc.info/gems/dependent-fields-rails/0.4.2
我只是尝试过什么提到教程,我得到以下错误
app / views / houses / _form.html.haml:8:语法错误,意外的tIDENTIFIER,期待')'app / views / houses / _form.html.haml:8:语法错误,意外')',期待keyword_end app / views / houses / new.html.haml:4:in`_app_views_houses_new_html_haml___583738311_56256552'
这是我的houses_form.erb.haml
= simple_form_for @house do |f|
= f.input :doorno, :label => "House No or Name:"
= f.input :house_title, :label => "Street Name:"
= f.input :postcode, :label => "Post Code:"
= f.input :description, :label => "Description:"
= f.input :price, as: :currency, :inline_label => "Price:"
= f.input :occupied, inline_label: 'Tick if the Property Occupied'
.js-dependent-fields{data-checkbox-id='house_occupied' data-checkbox-
value='true'}
= f.association :tenant, :label => "Tenant Name:"
= f.button :submit, class: "button"
租户字段仅显示是否勾选了占用的框
的application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require underscore
//= require dependent-fields
$(document).ready(function() {
DependentFields.bind()
}
尝试将{}更改为[],仍然存在类似的语法错误
看起来你在your{}
电话中使用.js-dependent-fields
。尝试将{}
更改为[]
。