Class: Iron::Api::Schema::LocalesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @locale = Locale.new(locale_params)

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

#destroyObject



32
33
34
35
36
37
38
# File 'app/controllers/iron/api/schema/locales_controller.rb', line 32

def destroy
  if @locale.destroy
    head :no_content
  else
    render json: @locale.errors, status: :unprocessable_entity
  end
end

#indexObject



7
8
9
# File 'app/controllers/iron/api/schema/locales_controller.rb', line 7

def index
  @locales = Locale.order(:code)
end

#showObject



11
12
# File 'app/controllers/iron/api/schema/locales_controller.rb', line 11

def show
end

#updateObject



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

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