所以我試圖添加此代碼首先視圖,然後控制器。它沒有工作,並給了我一個錯誤:未定義的方法保存爲4:Fixnum。Rails沒有索引位置
代碼:
<% unless location.user.interests.blank? %>
<% @merged_array = location.user.interests.split(',').uniq +
current_user.interests.split(',').uniq %>
<% location.score = @merged_array.length - @merged_array.uniq.length %>
<% location.score.save %>
<% else %>
<% location.score = 0 %>
<% location.score.save %>
<% end %>
但後來我從兩個控制器和視圖.....現在索引頁面沒有顯示的位置在所有我檢查和顯示頁面是工作和記錄刪除它依然存在: INDEX.HTML.ERB:https://github.com/Hisaan-Anjum/friends/blob/master/app/views/locations/index.html.erb 控制器:https://github.com/Hisaan-Anjum/friends/blob/master/app/controllers/locations_controller.rb
請在你的問題中添加代碼,而不是提供外部鏈接。 – Gerry