Sha256: e4c2e3acc64984687d1e45758c3df25fc7b2608c5038eac9a6f80665771648f4

Contents?: true

Size: 711 Bytes

Versions: 3

Compression:

Stored size: 711 Bytes

Contents

require_dependency "mongoid_forums/application_controller"

module MongoidForums
  module Admin
    class CategoriesController < BaseController
      def new
        @category = Category.new
      end

      def create
        if @category = Category.create(name: params[:category][:name])
          flash[:notice] = "Category created successfully"
          redirect_to root_path
        else
          flash.now.alert = "Category could not be created"
          render :action => "new"
        end
      end

      def edit
      end

      def update
      end

      def destroy
      end

      private

      def category_params
        params.require(:category).permit(:name)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-forums-0.0.3 app/controllers/mongoid_forums/admin/categories_controller.rb
mongoid-forums-0.0.2 app/controllers/mongoid_forums/admin/categories_controller.rb
mongoid-forums-0.0.1 app/controllers/mongoid_forums/admin/categories_controller.rb