我新的軌道,並收到以下錯誤未初始化的常量與軌道友誼
{"authenticity_token"=>"eQvv3flATE+P1TEErOWP/6fM8dEOIBxltobCxtM/F18=",
"friend_id"=>"32"}
當我點擊「添加好友」鏈接我的用戶顯示頁面。我正在關注自我參照關聯到一個T的railscast,但我不斷收到這個錯誤,我找不到任何關於它的信息,甚至沒有「未初始化常量」的含義。我從互聯網上收集到的信息可能與acts_as_authenticated插件有關,但我遵循我找到的一個修復程序,但它無效。
這裏是我的用戶/ show.html.erb頁面的代碼:
<%= link_to "Add Friend", friendships_path(:friend_id => @user.id), :method => :post %>
和我的友誼控制器代碼:
def create
@friendship = current_user.friendships.build(:friend_id => params[:friend_id])
if @friendship.save
flash[:notice] = "Added friend."
redirect_to root_url
else
flash[:error] = "Unable to add friend."
redirect_to root_url
end
end
我要去哪裏錯在這裏。我沒有最微弱的線索是什麼導致了這一點。如果我缺少任何所需的代碼,請告訴我。
是得到了它。出於某種原因,我需要將文件名更改爲「friendships_controller.rb」,因爲它由於某種原因生成爲「friendship_controller.rb」。我還必須將「Friends FriendsControlController
goddamnyouryan
2010-02-16 03:39:27