Sha256: cf3a01a6fd71ad26e831db96a2eb9ea5206737ac03aa628a85f2dd9cb6b5262c
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
module RailsDb class TablesController < RailsDb::ApplicationController def index @tables = RailsDb::Database.accessible_tables end def show @table = RailsDb::Table.new(params[:id]) end def data per_page = params[:per_page] || session[:per_page] session[:per_page] = per_page @table = RailsDb::Table.new(params[:table_id]).paginate page: params[:page], sort_column: params[:sort_column], sort_order: params[:sort_order], per_page: per_page end def csv @table = RailsDb::Table.new(params[:table_id]) send_data(@table.to_csv, type: 'text/csv; charset=utf-8; header=present', filename: "#{@table.name}.csv") end def truncate @table = RailsDb::Table.new(params[:table_id]) @table.truncate render :data end def destroy @table = RailsDb::Table.new(params[:table_id]).paginate page: params[:page], sort_column: params[:sort_column], sort_order: params[:sort_order], per_page: session[:per_page] @table.delete(params[:pk_id]) respond_to do |page| page.html { redirect_to action: :data, table_id: params[:table_id] } page.js {} end end def xlsx @table = RailsDb::Table.new(params[:table_id]) render xlsx: 'table', filename: "#{@table.name}.xlsx" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_db-0.8 | app/controllers/rails_db/tables_controller.rb |