我試圖跟隨軌道入門指南http://guides.rubyonrails.org/getting_started.html創建一個博客,一個小網站我在軌道發展軌行動「秀」的CommentsController錯誤找不到
我讀過因此,許多類似的問題,但我仍然無法弄清楚爲什麼我試圖摧毀一個評論,如在指南中所做的那樣,不斷得到錯誤The action 'show' could not be found for CommentsController error
。
這是我在我的html.erb代碼鏈接:
<%= link_to 'Destroy Comment', [comment.post, comment], :confirm => 'Are you sure you want to delete?', :method => :delete %>
我的模板頭具有這些線路
<%= csrf_meta_tag %>
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", "rails", "superfish", "jquery.quicksand", 'slides.min.jquery' %>
我的Gemfile包含此:
gem 'jquery-rails'
我也注意到當我使用銷燬註釋鏈接加載頁面時,在螢幕控制檯中出現此錯誤:
"NetworkError: 404 Not Found - http://localhost:3000/assets/rails.js"
任何幫助解決這個問題表示讚賞。讓我知道你是否想要發佈其他內容。
編輯: 清單文件。
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
的routes.rb
Allthingswebdesign :: Application.routes.draw做
get "about/index"
get "home/index"
get "portfolio/index"
get "contact/index"
post "contact/create"
get "contact/new"
get "posts/index"
get "posts/new"
資源:帖子做 資源:評論 結束
根:到=>' home#index' end
自添加gem以來,你的運行包安裝了嗎? – natedavisolds
是的,我在添加gem後運行了bundle install。 – Catfish
如果沒有rails.js文件,鏈接將不會轉換爲使用刪除方法,並且確實將顯示路由。只是想確認加載這個資產是否是問題 – natedavisolds