Class: PgRest::TablesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pg_rest/tables_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_request!

Instance Method Details

#createObject



17
18
19
20
# File 'app/controllers/pg_rest/tables_controller.rb', line 17

def create  
  PgService.create_table(table_name: pg_params[:name])
  render json: { message: 'Table created.' }
end

#destroyObject



22
23
24
25
# File 'app/controllers/pg_rest/tables_controller.rb', line 22

def destroy  
  PgService.drop_table(table_name: params[:id])
  render json: { message: 'Table dropped.' }
end

#indexObject



7
8
9
10
# File 'app/controllers/pg_rest/tables_controller.rb', line 7

def index 
  schema = PgRest::Schema.pg_schema       
  render json: { data: schema }
end

#showObject



12
13
14
15
# File 'app/controllers/pg_rest/tables_controller.rb', line 12

def show 
  table = PgRest::Schema.table_schema(params[:id])
  render json: { data: table }
end