Class: Dscf::Marketplace::AgentsController

Inherits:
ApplicationController show all
Includes:
Core::Common
Defined in:
app/controllers/dscf/marketplace/agents_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#bypass_permissions_for_demo?, #pundit_user

Instance Method Details

#destroyObject



19
20
21
22
23
24
# File 'app/controllers/dscf/marketplace/agents_controller.rb', line 19

def destroy
  @obj = find_record
  authorize @obj
  @obj.destroy!
  render_success("agent.success.destroy")
end

#registerObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/dscf/marketplace/agents_controller.rb', line 6

def register
  authorize @clazz.new, :register?

  obj = @clazz.new(registration_params)
  ActiveRecord::Base.transaction do
    if obj.save
      render_success("agent.success.register", data: obj, status: :created)
    else
      render_error("agent.errors.register", errors: obj.errors.full_messages[0], status: :unprocessable_entity)
    end
  end
end