Sha256: 1fe52296971ed2211bde9f761000f3ddac0238d71c083ccd7cebf74365d9f77a

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

require_dependency "mongoid_forums/application_controller"

module MongoidForums
  module Admin
    class Admin::ForumsController < BaseController
      def new
        @forum = Forum.new
      end

      def create
        if @forum = Forum.create(name: params[:forum][:name], category: params[:forum][:category])
          flash[:notice] = "Category created successfully"
          redirect_to @forum
        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(:forum).permit(:name, :category)
      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/forums_controller.rb
mongoid-forums-0.0.2 app/controllers/mongoid_forums/admin/forums_controller.rb
mongoid-forums-0.0.1 app/controllers/mongoid_forums/admin/forums_controller.rb