blob: eebad5e7b03c953a02a1c9e3f09348292e9bc900 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
class ApiKeysController < InheritedResources::Base
defaults resource_class: Api::V1::ApiKey
include PolicyChecker
def create
@api_key = Api::V1::ApiKey.new(api_key_params.merge(organisation: current_organisation))
create! do |format|
format.html {
redirect_to dashboard_path
}
end
end
def update
update! do |format|
format.html {
redirect_to dashboard_path
}
end
end
def destroy
destroy! do |format|
format.html {
redirect_to dashboard_path
}
end
end
private
def api_key_params
params.require(:api_key).permit(:name, :referential_id)
end
def decorate_api_keys(api_keys)
ModelDecorator.decorate(
api_keys,
with: ApiKeyDecorator,
)
end
end
|