Class: PDNS::DomainsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pdns/domains_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/pdns/domains_controller.rb', line 17

def create
  @domain = Domain.new(domain_params)

  if @domain.save
    render json: @domain, status: :created
  else
    render json: @domain.errors, status: :unprocessable_entity
  end
end

#destroyObject



27
28
29
30
31
32
# File 'app/controllers/pdns/domains_controller.rb', line 27

def destroy
  set_domain

  @domain.destroy
  head :no_content
end

#indexObject



5
6
7
8
9
# File 'app/controllers/pdns/domains_controller.rb', line 5

def index
  set_domains

  render json: @domains, status: :ok
end

#showObject



11
12
13
14
15
# File 'app/controllers/pdns/domains_controller.rb', line 11

def show
  set_domain

  render json: @domain, status: :ok
end