updating part2, far from finished

This commit is contained in:
2013-12-20 19:22:12 +01:00
parent 748944865d
commit b4c4a15e60
22 changed files with 2779 additions and 62 deletions
@@ -43,7 +43,7 @@ module Suppliers
# POST /tables
# POST /tables.json
def create
@table = Table.new(params[:table])
@table = Table.new(table_params)
@table.supplier = current_supplier
respond_to do |format|
@@ -63,8 +63,8 @@ module Suppliers
@table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
respond_to do |format|
if @table.update_attributes(params[:table])
format.html { redirect_to [:suppliers, @table], notice: t('action.update.successfull', model: Table.model_name.human) }
if @table.update_attributes(table_params)
format.html { redirect_to [:suppliers, @table.section || @table], notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
format.js { head :no_content }
else
@@ -92,5 +92,11 @@ module Suppliers
@tables.select!{|t| t.section_id == params[:section_id]} if params[:section_id].present?
render layout: 'qr_sheet'
end
private
def table_params
params.require(:table).permit(:number, :section_id, :position_x, :position_y)
end
end
end