【问题标题】:rails: syntax error, unexpected keyword_ensure, expecting end-of-inputrails:语法错误,意外的keyword_ensure,期望输入结束
【发布时间】:2014-11-01 13:18:08
【问题描述】:
<h3>Create Your Pokemon!</h3>
<%= simple_form_for @pokemon do |p|, :url => pokemon_path(id: @pokemon) %>
  <%= p.input :name, placeholder:'Pikacharmander' %>
  <%= p.button :submit,'Create' %>
<% end %>

我的代码和上面一样,但是每次运行都会出现这个错误

syntax error, unexpected ','
...imple_form_for @pokemon do |p|, :url => pokemon_path(id: @po...

谁能帮帮我?

【问题讨论】:

  • 试试这个 pokemon_path(id: @pokemon) 做 |p| %>

标签: ruby-on-rails


【解决方案1】:

尝试以下修复:-

<h3>Create Your Pokemon!</h3>
<%= simple_form_for @pokemon, :url => pokemon_path(id: @pokemon) do |p| %>
  <%= p.input :name, placeholder:'Pikacharmander' %>
  <%= p.button :submit,'Create' %>
<% end %>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多