Class: Ponytail::MigrationsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/ponytail/migrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/ponytail/migrations_controller.rb', line 14

def create
  @migration = Migration.new(migraion_params)

  if @migration.save
    redirect_to :migrations, notice: 'Migration was successfully created.'
  else
    render action: 'new'
  end
end

#indexObject



5
6
7
8
# File 'app/controllers/ponytail/migrations_controller.rb', line 5

def index
  @migrations = Migration.all
  @current_version = Migration.current_version
end

#migrateObject



24
25
26
27
28
29
30
# File 'app/controllers/ponytail/migrations_controller.rb', line 24

def migrate
  if Migration.migrate
    redirect_to :migrations, notice: 'Migrate was succeed.'
  else
    redirect_to :migrations, notice: 'Migrate was failed.'
  end
end

#newObject



10
11
12
# File 'app/controllers/ponytail/migrations_controller.rb', line 10

def new
  @migration = Migration.new
end

#rollbackObject



32
33
34
35
36
37
38
# File 'app/controllers/ponytail/migrations_controller.rb', line 32

def rollback
  if Migration.rollback
    redirect_to :migrations, notice: 'Rollback was succeed.'
  else
    redirect_to :migrations, notice: 'Rollback was failed.'
  end
end