使用simple_form获取此错误:
这是我的浏览页面代码:
联系
路线:
HarrisRobin :: Application.routes.draw做资源:仅限联系人: [:new,:create] root to:'pages#about'get'/ projects'=> 'pages#projects'get'/ about'=> '页面#关于'结束
我的错误:
/ contacts / new语法错误的语法错误,意外的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?
我做错了什么?我已经敲了几个小时,没有看到错误。
答案 0 :(得分:1)
您指定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 %>