3
總之,我剛剛將一個評論腳手架遷移到應用程序。目標是在歌曲的表演動作中顯示評論。很簡單,我有一個歌曲模型,一個評論模型和一個用戶模型。用戶可以上傳歌曲 - 我希望用戶能夠爲歌曲添加評論。不幸的是,我遇到了下面的錯誤。我已經研究了各種解決方案無濟於事。表單中的第一個參數不能包含零或爲空[評論]
錯誤信息:
ArgumentError in Songs#show
Showing /Users/apane/Downloads/leap/app/views/comments/_form.html.erb where line #1 raised:
First argument in form cannot contain nil or be empty
<%= form_for @comment do |f| %>
<% if @comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
見下面GitHub的 - 我覺得這是對故障最有效的方法,因爲它是很容易快速瀏覽到相應的目錄。
www.github.com/apane/leap
我的朋友,謝謝。 – Apane101
不客氣:-) – rmagnum2002
順便說一句,你的應用程序使用rails 4,所以你應該用rails 4來標記你的問題。這種方式可以更容易地調試問題。 – rmagnum2002