Class: Champollion::TranslationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/champollion/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /translations



29
30
31
32
33
34
35
36
37
# File 'app/controllers/champollion/translations_controller.rb', line 29

def create
  @translation = Translation.new(translation_params)

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

#destroyObject

DELETE /translations/1



49
50
51
52
# File 'app/controllers/champollion/translations_controller.rb', line 49

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

#editObject

GET /translations/1/edit



25
26
# File 'app/controllers/champollion/translations_controller.rb', line 25

def edit
end

#indexObject

GET /translations



8
9
10
11
12
13
# File 'app/controllers/champollion/translations_controller.rb', line 8

def index
  respond_to do |format|
    format.html { @translations = Translation.all }
    format.json { render json: Translation.all_hash.to_json }
  end
end

#newObject

GET /translations/new



20
21
22
# File 'app/controllers/champollion/translations_controller.rb', line 20

def new
  @translation = Translation.new
end

#showObject

GET /translations/1



16
17
# File 'app/controllers/champollion/translations_controller.rb', line 16

def show
end

#updateObject

PATCH/PUT /translations/1



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

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