Class: BrowSql::TablesController

Inherits:
BrowSqlController show all
Defined in:
app/controllers/brow_sql/tables_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/brow_sql/tables_controller.rb', line 20

def create
  @table = Table.new(params[:table])

  if @table.save
    redirect_to @table, notice: "#{@table.name} table was successfully created."
  else
    render action: "new"
  end
end

#destroyObject



38
39
40
41
42
43
# File 'app/controllers/brow_sql/tables_controller.rb', line 38

def destroy
  flash[:notice] = "#{@table.name} table was successfully destroyed."
  @table.destroy

  redirect_to tables_url
end

#editObject



17
18
# File 'app/controllers/brow_sql/tables_controller.rb', line 17

def edit
end

#indexObject



6
7
8
# File 'app/controllers/brow_sql/tables_controller.rb', line 6

def index
  @tables = Table.all
end

#newObject



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

def new
  @table = Table.new
end

#showObject



10
11
# File 'app/controllers/brow_sql/tables_controller.rb', line 10

def show
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/brow_sql/tables_controller.rb', line 30

def update
  if @table.update_attributes(params[:table])
    redirect_to @table, notice: "#{@table.name} table was successfully updated."
  else
    render action: "edit"
  end
end