Sha256: 585065bf6f095c11059cc16f541c95f87d3ee555bcdf2f0025bb6176bef3ac8b

Contents?: true

Size: 968 Bytes

Versions: 34

Compression:

Stored size: 968 Bytes

Contents

module Ecom
  module Core
    class ApplicationModulesController < ApplicationController
      def index
        render json: ApplicationModule.all
      end

      def create
        application_module = ApplicationModule.new(application_module_params)
        if application_module.save
          render json: application_module, status: :created
        else
          render json: { success: false, errors: application_module.errors }, status: :unprocessable_entity
        end
      end

      def update
        application_module = ApplicationModule.find(params[:id])
        if application_module.update(application_module_params)
          render json: application_module
        else
          render json: { success: false, errors: application_module.errors }, status: :unprocessable_entity
        end
      end

      private

      def application_module_params
        params.require(:application_module).permit(:code, :name)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
ecom_core-1.1.20 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.19 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.18 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.17 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.16 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.15 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.14 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.13 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.12 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.11 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.10 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.9 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.8 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.7 app/controllers/ecom/core/application_modules_controller.rb