簡體   English   中英

語法錯誤,意外的tIDENTIFIER,期望使用keyword_end simple_form gem

[英]syntax error, unexpected tIDENTIFIER, expecting keyword_end simple_form gem

使用simple_form獲取此錯誤:

這是我的查看頁面代碼:

聯系

聯系

<%= simple_form_for(@contact)做| f | %> <%= form.error_notification%> <%= form.input:name,自動對焦:true%> <%= form.input:email%> <%= form.input:content,as::text%> < %= form.button:提交,'提交',類:'提交'%> <%結束%>

路線:

HarrisRobin :: Application.routes.draw做資源:contacts,僅:[:new,:create]根目錄到:'pages#about'獲取'/ projects'=>'pages#projects'獲取'/ about'=>'第#about頁的結尾

我的錯誤:

/ contacts / new語法錯誤處的SyntaxError,出現意外的tIDENTIFIER,需要keyword_end

activesupport(4.0.0)lib / active_support / dependencies.rb

  const_paths = [const_paths].compact unless const_paths.is_a? Array parent_paths = const_paths.collect { |const_path| const_path[/.*(?=::)/] || :Object } result = nil newly_defined_paths = new_constants_in(*parent_paths) do result = Kernel.load path end autoloaded_constants.concat newly_defined_paths unless load_once_path?(path) autoloaded_constants.uniq! log "loading #{path} defined #{newly_defined_paths * ', '}" unless newly_defined_paths.empty? 

我究竟做錯了什么 ? 我已經好幾個小時不停地動腦子了,看不到錯誤。

您將f指定為構建器參數,但在構建器內部使用了form

<%= simple_form_for(@contact) do |f| %> 
  <%= f.error_notification %>
  <%= f.input :name, autofocus: true %>
  <%= f.input :email %>
  <%= f.input :content, as: :text %>
  <%=f.button :submit, 'Submit', class: 'submit' %>
<% end %>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM