Sha256: b5e6da020ade1bc04fe641f4a7a5dacafd610682414af2960db137e89872de3e

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 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)
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy_reports-0.0.13 app/controllers/easy_reports/database_configs_controller.rb
easy_reports-0.0.11 app/controllers/easy_reports/database_configs_controller.rb