Class: AestheticsController

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

Overview

Handles aesthetic modifications

Instance Method Summary collapse

Instance Method Details

#createnil

Deprecated.

no use

Returns:

  • (nil)
[View source]

10
11
# File 'app/controllers/aesthetics_controller.rb', line 10

def create
end

#destroynil

Deprecated.

no use

Returns:

  • (nil)
[View source]

54
55
# File 'app/controllers/aesthetics_controller.rb', line 54

def destroy
end

#editAesthetic

This method sets the aesthetic object to be edited

Parameters:

  • id (Integer)

    the id of aesthetic object to be edited

Returns:

[View source]

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

def edit
  @aesthetic = Aesthetic.find_by(id: params[:id])
end

#indexnil

Deprecated.

no use

Returns:

  • (nil)
[View source]

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

def index
end

#reload_demoAesthetic

This method uploads the dummy Aesthetic model for the partial view

Parameters:

  • id (Integer)

    the id of aesthetic object to be updated (hardcoded demo is currently -1)

  • aesthetic_params (Hash)

    the updates to be made

Returns:

[View source]

40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/aesthetics_controller.rb', line 40

def reload_demo
  @aesthetic = Aesthetic.find(params[:id])

  if @aesthetic.update(aesthetic_params)
    respond_to do |format|
      format.html { render partial: "shared/#{params[:game_id]}" }
    end
  else
    render json: { error: @aesthetic.errors.full_messages }, status: :unprocessable_entity
  end
end

#updateAesthetic

This method updates the aesthetic object

Parameters:

  • id (Integer)

    the id of aesthetic object to be updated

  • aesthetic_params (Hash)

    the updates to be made

Returns:

[View source]

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

def update
  @aesthetic = Aesthetic.find_by(id: params[:id])
  if @aesthetic.update(aesthetic_params)
    redirect_to edit_aesthetic_path(@aesthetic), notice: "Aesthetic was successfully updated."
  else
    redirect_to edit_aesthetic_path(@aesthetic), alert: "Aesthetic was not updated."
  end
end