Class: Admin::TranslationsController

Inherits:
ForestController
  • Object
show all
Defined in:
app/controllers/admin/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/admin/translations_controller.rb', line 21

def create
  @translation = Translation.new(translation_params)
  authorize @translation

  if @translation.save
    redirect_to edit_admin_translation_path(@translation), notice: 'Translation was successfully created.'
  else
    render :new
  end
end

#destroyObject



42
43
44
45
46
# File 'app/controllers/admin/translations_controller.rb', line 42

def destroy
  authorize @translation
  @translation.destroy
  redirect_to admin_translations_url, notice: 'Translation was successfully destroyed.'
end

#editObject



17
18
19
# File 'app/controllers/admin/translations_controller.rb', line 17

def edit
  authorize @translation
end

#indexObject



4
5
6
# File 'app/controllers/admin/translations_controller.rb', line 4

def index
  @translations = apply_scopes(Translation).by_key.page params[:page]
end

#newObject



12
13
14
15
# File 'app/controllers/admin/translations_controller.rb', line 12

def new
  @translation = Translation.new
  authorize @translation
end

#showObject



8
9
10
# File 'app/controllers/admin/translations_controller.rb', line 8

def show
  authorize @translation
end

#updateObject



32
33
34
35
36
37
38
39
40
# File 'app/controllers/admin/translations_controller.rb', line 32

def update
  authorize @translation

  if @translation.update(translation_params)
    redirect_to edit_admin_translation_path(@translation), notice: 'Translation was successfully updated.'
  else
    render :edit
  end
end