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.2.12 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.11 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.10 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.9 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.7 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.6 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.5 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.4 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.3 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.2 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.1 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.2.0 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.28 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.27 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.26 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.25 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.24 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.23 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.22 app/controllers/ecom/core/application_modules_controller.rb
ecom_core-1.1.21 app/controllers/ecom/core/application_modules_controller.rb