Sha256: 7b280a8214822caee200e00a40b0bdda90cdec48bf0210fe123716123184ff50

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require_dependency "easy_reports/application_controller"

module EasyReports
  class DatabaseConfigsController < ApplicationController
    before_action :set_database_config, only: [:show, :edit, :update, :destroy]

    def index
      @database_configs = DatabaseConfig.all
    end

    def show
    end

    def new
      @database_config = DatabaseConfig.new
    end

    def edit
    end

    def create
      @database_config = DatabaseConfig.new(database_config_params)

      if @database_config.save
        redirect_to @database_config, notice: 'Database config was successfully created.'
      else
        render :new
      end
    end

    def update
      if @database_config.update(database_config_params)
        redirect_to @database_config, notice: 'Database config was successfully updated.'
      else
        render :edit
      end
    end

    def destroy
      @database_config.destroy
      redirect_to database_configs_url, notice: 'Database config was successfully destroyed.'
    end

    private
      def set_database_config
        @database_config = DatabaseConfig.find(params[:id])
      end

      def database_config_params
        params.require(:database_config).permit(:adapter, :encoding, :pool, :username, :password, :host, :database_name, :port)
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
easy_reports-0.0.22 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.21 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.20 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.19 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.18 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.17 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.16 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.15 app/controllers/easy_reports/database_configs_controller.rb