Sha256: 6305db87ea97fa695246865dfe5037e36230958cc091bceb30cc075171f3d725

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

require_dependency "bagboy/application_controller"

module Bagboy
  class DataBagsController < ApplicationController

    def index
      render :index
    end

    def show
      @bag    = @bag_helper.data_bag params[:bag]
      @items  = @bag.items
      render :show
    end

    def new
      @bag = Bagboy::Chef::DataBags::Bag.new
      render :new
    end

    def create
      opts          = data_bag_params
      opts[:path]   = @bag_helper.data_bag_directory( opts[:name] )
      @bag          = Bagboy::Chef::DataBags::Bag.new( opts )

      if @bag.create
        redirect_to data_bags_path
      else
        render :new
      end
    end

    private

    def data_bag_params
      params.require(:data_bag).permit(:name, :path)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bagboy-0.0.1 app/controllers/bagboy/data_bags_controller.rb