私はコードの次のセクションでこの奇妙な問題に直面しています
<% if (@more == -1) %>
<%= link_to_remote "More Posts", :html => {:id => 'more-link', :onClick => 'return false;'}%>
<% else %>
<%= link_to_remote "More Posts", :url => {:action => 'view' ,:id => @more.to_i + 1} , :html => {:id => 'more-link'} %>
<% end %>
このコードを使用すると、次のエラーが発生します
You have a nil object when you didn't expect it!You might have expected an instance of ActiveRecord::Base.The error occurred while evaluating nil.[]
また、エラーはこの行にあるようです。
<%= link_to_remote "More Posts", :html => {:id => 'more-link', :onClick => 'return false;'}%>
では、なぜこれが機能しないのかを本当に理解することはできませんか?