Class: Ecom::Core::ApplicationModulesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ecom/core/application_modules_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #logged_in?

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
# File 'app/controllers/ecom/core/application_modules_controller.rb', line 8

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

#indexObject



4
5
6
# File 'app/controllers/ecom/core/application_modules_controller.rb', line 4

def index
  render json: ApplicationModule.all
end

#updateObject



17
18
19
20
21
22
23
24
# File 'app/controllers/ecom/core/application_modules_controller.rb', line 17

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