Class: FrontEndBuilds::PubkeysController
Instance Method Summary
collapse
#error!, #respond_with_json
Instance Method Details
#create ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/front_end_builds/pubkeys_controller.rb', line 10
def create
pubkey = FrontEndBuilds::Pubkey.new(pubkey_create_params)
if pubkey.save
respond_with_json(
{ pubkey: pubkey.serialize },
location: nil
)
else
error!(pubkey.errors)
end
end
|
#destroy ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/front_end_builds/pubkeys_controller.rb', line 23
def destroy
pubkey = FrontEndBuilds::Pubkey.find(params[:id])
if pubkey.destroy
respond_with_json(
{ pubkey: { id: pubkey.id } },
location: nil
)
else
error!(pubkey.errors)
end
end
|
#index ⇒ Object
5
6
7
8
|
# File 'app/controllers/front_end_builds/pubkeys_controller.rb', line 5
def index
keys = FrontEndBuilds::Pubkey.order(:name)
respond_with_json(pubkeys: keys.map(&:serialize))
end
|