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.3.14 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.13 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.12 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.11 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.10 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.9 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.8 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.7 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.6 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.5 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.4 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.3 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.2 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.1 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.3.0 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.36 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.35 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.34 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.33 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.32 app/controllers/ecom/core/application_modules_controller.rb