Class: Iron::Api::Schema::ContentTypesController

Inherits:
BaseController show all
Defined in:
app/controllers/iron/api/schema/content_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/iron/api/schema/content_types_controller.rb', line 15

def create
  @content_type = ContentType.new(content_type_params.merge(type: classified_type))

  if @content_type.save
    render :show, status: :created, location: api_schema_content_type_url(@content_type)
  else
    render json: @content_type.errors, status: :unprocessable_entity
  end
end

#destroyObject



33
34
35
36
# File 'app/controllers/iron/api/schema/content_types_controller.rb', line 33

def destroy
  @content_type.destroy!
  head :no_content
end

#indexObject



8
9
10
# File 'app/controllers/iron/api/schema/content_types_controller.rb', line 8

def index
  @content_types = ContentType.order(:name)
end

#showObject



12
13
# File 'app/controllers/iron/api/schema/content_types_controller.rb', line 12

def show
end

#updateObject



25
26
27
28
29
30
31
# File 'app/controllers/iron/api/schema/content_types_controller.rb', line 25

def update
  if @content_type.update(content_type_params)
    render :show
  else
    render json: @content_type.errors, status: :unprocessable_entity
  end
end