我正在关注rails:http://guides.rubyonrails.org/getting_started.html的本教程,我已经到了5.2中你改变行的部分
<%= form_for :post do |f| %>
到
<%= form_for :post, url: posts_path do |f| %>
每次我更改它时,都会收到此错误:
SyntaxError in Posts#new
Showing /home/hiram/rails/blog/app/views/posts/new.html.erb where line #2 raised:
compile error
/home/hiram/rails/blog/app/views/posts/new.html.erb:2: syntax error, unexpected ':', expecting kEND
....append= form_for :post, url: posts_path do |f| @output_buf...
^
Extracted source (around line #2):
1: <h1>New Post</h1>
2: <%= form_for :post, url: posts_path do |f| %>
3: <p>
4: <%= f.label :title %><br>
5: <%= f.text_field :title %>
Trace of template inclusion: app/views/posts/new.html.erb
Rails.root: /home/hiram/rails/blog