Class: ActiveRecordMigrationUi::MigrationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/active_record_migration_ui/migrations_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(env) ⇒ Object

Rack Middleware uses this method in order to run the index action.



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

def self.call(env)
  action(:index).call(env)
end

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/active_record_migration_ui/migrations_controller.rb', line 10

def index
  respond_to do |format|
    format.html
    format.json do
      interactor = FindAllPendingMigrationScripts.call
      if interactor.failure?
        render json: interactor.errors, status: :unprocessable_entity
      else
        render json: interactor.scripts, status: :ok
      end
    end
  end
end