Class: Dscf::Marketplace::AgentsController
Instance Method Summary
collapse
#bypass_permissions_for_demo?, #pundit_user
Instance Method Details
#destroy ⇒ Object
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
|
#register ⇒ Object
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
|