我正在尝试使用best_in_place gem来允许对我的数据表进行内联编辑。我已成功将其添加到另一个,但是当我添加由于某种原因实现best_in_place的表的最后一列时,现在添加它会创建一个异国情调的路径变量campaign_category_metro_bid_path
。
为什么会发生错误?
update_bidding.html.erb:
<tbody>
<% CampaignCategoryMetroBid.where(campaign_id: @campaign.id).each do |biddetail| %>
<tr>
<td><%= biddetail.id %></td>
<td><%= biddetail.campaign_id %></td>
<td><%= biddetail.category_id %></td>
<td><%= biddetail.metro_id %></td>
<td><%= biddetail.average_bid_price %></td>
<td><%= biddetail.average_placement %></td>
<td><%= biddetail.number_times_pulled %></td>
<td><%= biddetail.clicks %></td>
<td><%= biddetail.shares %></td>
<td><%= biddetail.get_there %></td>
<td><%= biddetail.user_saves %></td>
<td><%= best_in_place biddetail, :set_max_bid %></td>
</tr>
<% end %>
</tbody>
广告系列控制器操作:
def update_bidding
@campaign = Campaign.find_by_id(params[:id])
end
错误:
undefined method `campaign_category_metro_bid_path' for #<#<Class:0xa01f610>:0x601b360>
Extracted source (around line #52):
49
50
51
52
53
54
55
<td><%= biddetail.shares %></td>
<td><%= biddetail.get_there %></td>
<td><%= biddetail.user_saves %></td>
<td><%= best_in_place biddetail, :set_max_bid %></td>
</tr>
<% end %>
</tbody>
答案 0 :(得分:0)
原来我只是忘记将新控制器放入路径中,以便可以访问路径:
resources :campaign_category_metro_bids, only: [:update, :update_bidding]
现在全部工作