Class: Iron::LocalesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

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



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

def edit
end

#indexObject



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

def index
  @locales = Locale.all
end

#newObject



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

def new
  @locale = Locale.new
end

#updateObject



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

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