Sha256: c48a599ef4458adb82284c21328d6ba0f1a6537ef4bcf69fdf283c4fab7aa5b0

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

module Ponytail
  class MigrationsController < ActionController::Base
    layout 'ponytail/application'
    respond_to :html, only: [:index, :new]
    respond_to :json, only: [:index, :create, :destroy]

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

    def new
      @migration = Migration.new
      @schema = Schema.new
    end

    def create
      @migration = Migration.create(migraion_params)
      flash[:notice] = "Migration was successfully created."
      respond_with @migration
    end

    def destroy
      @migration = Migration.find(params[:id].to_i)
      if @migration
        @migration.destroy
        flash[:notice] = "Migration was successfully deleted."
        respond_with @migration
      else
        render nothing: true, status: 404
      end
    end

    private
    def migraion_params
      params.require(:ponytail_migration).permit(:name, :raw_content)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ponytail-0.6.0 app/controllers/ponytail/migrations_controller.rb