Sha256: 4ee8d12835ef3de70110e83fc53d31e4e452a3c07e6a9ed1d063780fb3b0ead1

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require_dependency 'localtower/application_controller'

module Localtower
  class PagesController < ApplicationController

    def dashboard
    end

    def status
      @data = ::Localtower::Status.new.run
    end

    def migrations
    end

    def post_migrations
      # Because we have a list or a field, take the item from the list in priority
      params[:migrations][:migrations] = params[:migrations][:migrations].map do |action_line|
        action_line["new_column_type"] = action_line["column_type"]

        if action_line["column"].present?
          action_line["column"] = action_line["column"]
        end

        if action_line["column_list"].present?
          action_line["column"] = action_line["column_list"]
        end

        action_line.delete("column_list")

        action_line
      end

      use_generator(::Localtower::Generators::Migration, params[:migrations])
      redirect_to migrations_path
    end

    def relations
    end

    def post_relations
      use_generator(::Localtower::Generators::Relation, params[:relations])
      redirect_to relations_path
    end

    def models
    end

    def post_models
      use_generator(::Localtower::Generators::Model, params[:models])
      redirect_to relations_path
    end

    private

    def use_generator(generator_klass, options)
      generator_klass.new(options).run
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
localtower-0.1.8 app/controllers/localtower/pages_controller.rb