这很奇怪。我正在使用“最佳原地”宝石与一个无序列表与每个列表项目,包括‘最佳就地’助手。列表中的第一项工作正常,但后续列表项有问题。这是“我的部分”(view/_dash.html.erb)中的代码:
<table class = 'table-hover'>
<li>
<tr>
<th class = 'name'> <%= best_in_place offer, :plan_name, :type => :input %> </th>
<th class = 'name'> <%= best_in_place offer, :price, :type => :input %> </th>
<th class = 'bids'> Bids(<%= @user.active_bids.count %>) </th>
</tr>
</li>
以及关联视图中的代码:
<ul class = "offers">
<%= render @offers %>
</ul>
<%= will_paginate %>列表中的第一项工作正常。每个字段都显示正确的信息,是可编辑的,并且编辑在db中持久存在。第二项显示正确的字段,是可编辑的,更新信息。但是,刷新后,字段将恢复到原来的值,并贴现所做的编辑。列表中的其他项目最初显示正确的字段,但有些是不可编辑的,有些是可编辑的,但不更新信息,有些是可编辑的,但编辑的信息不持久。这是关联控制器的代码:
def update
@user = current_user
@offer = Offer.find params[:id]
if @offer.update_attributes!(offer_params)
respond_to do |format|
format.html { redirect_to( @offer )}
format.json { render :json => @offer }
end
else
respond_to do |format|
format.html { render :action => :show } # edit.html.erb
format.json { render :nothing => true }
end
end
def dash
@user = current_user
@offers = current_user.offers.paginate(page: params[:page])
respond_to do |format|
format.html
format.json {render :json => @offer}
end我的application.js看起来是这样的:
//= require jquery
//= require jquery.purr
//= require best_in_place
//= require 'rest_in_place'
//= require jquery_ujs
//= require best_in_place.jquery-ui
//= require bootstrap
//= require turbolinks
//= require_tree .这是我的offers.coffee文件:
jQuery ->
$('.best_in_place').best_in_place()请告诉我,如果你需要更多的信息,如果我错过了一些明显的东西,或如果有一个修复。求救。
发布于 2017-03-27 22:05:28
好了修好了。这是我以前的一个过滤器的问题。那些人的事很抱歉。
https://stackoverflow.com/questions/43017357
复制相似问题