Sha256: 33ab3a35cdabd2a9375248d6fc53249fd16b47a913d3e8170aa45c55ab9cc0a7

Contents?: true

Size: 969 Bytes

Versions: 39

Compression:

Stored size: 969 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

39 entries across 39 versions & 1 rubygems

Version Path
ecom_core-1.2.31 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.30 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.29 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.28 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.27 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.26 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.25 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.24 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.23 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.22 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.21 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.20 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.19 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.18 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.17 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.16 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.15 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.14 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.13 app/controllers/ecom/core/application_modules_controller.rb