【发布时间】:2017-06-04 12:30:35
【问题描述】:
所以我尝试将此代码首先添加到视图中,然后添加到控制器中。它不起作用并给了我一个错误:未定义的方法保存为 4:Fixnum。
代码:
<% 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 %>
但是后来我从控制器和视图中删除了它.....现在索引页面根本没有显示我检查过的位置,并且显示页面正在工作并且记录仍然存在
【问题讨论】:
-
请在您的问题中添加代码,而不是提供外部链接。
标签: mysql ruby-on-rails ruby database