我有兩個視圖,第一個是顯示所有授權的表,我如何通過只檢查授權檢查其他視圖?只通過複選框檢查其他視圖
這是第一個觀點:(都可以在這裏)
(...)
<% @authorizations.each do |authorization| %>
<tr>
<td><%= check_box_tag 'authorization_marked' %></td>
(...)
<%= f.button :submit, "To Reserve" %>
我的第一個和第二個控制器:
def index
if params[:search_employee_by_cpf].present?
@employees = Employee.search_cpf(params[:search_employee_by_cpf]).all
@authorizations = Authorization.search_employee_by_cpf(params[:search_employee_by_cpf]).all
else
@authorizations = []
end
end
# GET /refinancings/new
def new
@employee = Employee.search_cpf(params[:search_employee_by_cpf])
@authorizations.authorization_marked = true # PROBLEM HERE
@refinancing = Refinancing.new
end
在另一種觀點我想只顯示了檢查:
<h3>Reserved value</h3>
<table class="table table-condensed table-bordered table-striped">
<thead>
<th>Contract number</th>
<th>Parcel value X Quantity of Parcels</th>
</thead>
<% @authorizations.each do |authorization| %>
<tbody>
<tr>
<td><%= authorization.contract_number %></td>
<td><%= number_to_currency authorization.parcel_value %> x <%= authorization.qtd_parcel %></td>
</tr>
</tbody>
<% end %>
</table>
這部分:'我怎麼做的傳球只檢查了其他觀點的授權',我不明白,在所有。 –
需要更多的上下文。你可以顯示第一個視圖的整個表單部分嗎?還有控制器在您的第三代碼塊中渲染HTML的行爲? –
是的,我會更新 –