Class: Game2048::AestheticsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/game_2048/aesthetics_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



5
6
# File 'app/controllers/game_2048/aesthetics_controller.rb', line 5

def edit
end

#previewObject



16
17
18
19
20
21
22
# File 'app/controllers/game_2048/aesthetics_controller.rb', line 16

def preview
  if @aesthetic.update(aesthetic_params)
    render partial: "game2048/preview_board", layout: false
  else
    render json: { error: @aesthetic.errors.full_messages }, status: :unprocessable_entity
  end
end

#updateObject



8
9
10
11
12
13
14
# File 'app/controllers/game_2048/aesthetics_controller.rb', line 8

def update
  if @aesthetic.update(aesthetic_params)
    redirect_to edit_game_2048_aesthetic_path, notice: "2048 theme updated successfully."
  else
    render :edit
  end
end