到目前为止,我一直在关注一个教程并最终完成了这个:https ://github.com/ScarletMcLearn/jobsboard
但是“添加工作”链接应该出现在 index.html 页面上,如 index.html.erb 文件中所写:
<h1>Jobs</h1>
<% @jobs.each do |job| %>
<div class="job">
<h2><%= link_to job.title, job.url %></h2>
<p><%= job.company %></p>
</div>
<% end %>
<p><%= link_to "Add a job", new_job_path %></p>
但它不会来。我是 Rails 的新手,所以简单的说明将不胜感激。:D如果有帮助,请查看回购:https ://github.com/ScarletMcLearn/jobsboard。
感谢您的阅读。:D
耙路线输出:
前缀动词 URI 模式控制器#Action jobs GET /jobs(.:format) jobs#index POST /jobs(.:format) jobs#create new_job GET /jobs/new(.:format) jobs#new edit_job GET
/jobs/: id/edit(.:format) 工作#edit 工作 GET /jobs/:id(.:format) 工作#show PATCH /jobs/:id(.:format) 工作#update PUT /jobs/:id(.:format ) jobs#update DELETE /jobs/:id(.:format) jobs#destroy root GET /jobs#index