# -*- encoding : utf-8 -*- class Portlet::TableColsController < ApplicationController def create @table_content = TableContent.find(params[:table_content_id]) @table_content.table_rows.each do |table_row| CelTable.create( :position => params[:position], :table_row_id => table_row.id) end @table_content.nbr_cols = @table_content.nbr_cols + 1 @table_content.save end def update end def destroy @table_content = TableContent.find(params[:table_content_id]) CelTable.where(:table_row_id => @table_content.table_row_ids,:position => params[:id] ).each do |cel_table| cel_table.destroy end @table_content.nbr_cols = @table_content.nbr_cols - 1 @table_content.save end end