Class: Iron::LocalesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/iron/locales_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/iron/locales_controller.rb', line 18

def create
  @locale = Locale.new(locale_params)

  if @locale.save
    redirect_to locales_path, notice: "Locale was successfully created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



36
37
38
39
40
41
42
# File 'app/controllers/iron/locales_controller.rb', line 36

def destroy
  if @locale.destroy
    redirect_to locales_path, notice: "Locale was successfully destroyed.", status: :see_other
  else
    redirect_back fallback_location: locales_path, alert: @locale.errors.full_messages.to_sentence, status: :see_other
  end
end

#editObject



15
16
# File 'app/controllers/iron/locales_controller.rb', line 15

def edit
end

#indexObject



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

def index
  @locales = Locale.all
end

#newObject



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

def new
  @locale = Locale.new
end

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/iron/locales_controller.rb', line 28

def update
  if @locale.update(locale_params)
    redirect_to locales_path, notice: "Locale was successfully updated.", status: :see_other
  else
    render :edit, status: :unprocessable_entity
  end
end