Added update action
This commit is contained in:
parent
ffc8dbad8c
commit
557ccd6164
@ -39,6 +39,14 @@ class QuantitiesController < ApplicationController
|
|||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @quantity.update(quantity_params)
|
||||||
|
flash[:notice] = 'Updated quantity'
|
||||||
|
end
|
||||||
|
prepare_quantities
|
||||||
|
render :index
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @quantity.destroy
|
if @quantity.destroy
|
||||||
flash[:notice] = 'Deleted quantity'
|
flash[:notice] = 'Deleted quantity'
|
||||||
|
@ -61,7 +61,9 @@
|
|||||||
<%= delete_link quantity_path(q), {remote: true, data: {}} %>
|
<%= delete_link quantity_path(q), {remote: true, data: {}} %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% next unless (action_name == "edit") && (q == @quantity) %>
|
<% next unless (q == @quantity) &&
|
||||||
|
((action_name == "edit") || (action_name == "update" && @quantity.errors.present?))
|
||||||
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="form" colspan="6">
|
<td class="form" colspan="6">
|
||||||
<div id="edit-quantity">
|
<div id="edit-quantity">
|
||||||
|
Reference in New Issue
Block a user