end of day commit
This commit is contained in:
@@ -22,7 +22,7 @@ module Suppliers
|
||||
# GET /lists/1
|
||||
# GET /lists/1.json
|
||||
def show
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.json do
|
||||
@@ -36,6 +36,7 @@ module Suppliers
|
||||
def new
|
||||
@list = List.new
|
||||
@list.section_id = params[:section_id].presence
|
||||
@tables = current_supplier.active_tables
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
@@ -43,16 +44,36 @@ module Suppliers
|
||||
end
|
||||
end
|
||||
|
||||
# POST /lists
|
||||
# POST /lists.json
|
||||
def create
|
||||
@list = List.new(params[:list])
|
||||
@list.supplier = current_supplier
|
||||
|
||||
respond_to do |format|
|
||||
if @list.save
|
||||
format.html { redirect_to [:suppliers, @list.section || @list], notice: t('action.create.successfull', model: List.model_name.human) }
|
||||
format.json { render json: @list, status: :created, location: @list }
|
||||
else
|
||||
format.html do
|
||||
@tables = current_supplier.active_tables
|
||||
render action: "new"
|
||||
end
|
||||
format.json { render json: @list.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /lists/1/edit
|
||||
def edit
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@tables = current_supplier.active_tables
|
||||
end
|
||||
|
||||
# PUT /lists/1
|
||||
# PUT /lists/1.json
|
||||
def update
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @list.update_attributes(params[:list])
|
||||
@@ -71,7 +92,7 @@ module Suppliers
|
||||
# DELETE /lists/1
|
||||
# DELETE /lists/1.json
|
||||
def destroy
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@list.destroy
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
Reference in New Issue
Block a user