Class: CopiesController

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

Overview

typed: false

Instance Method Summary collapse

Methods inherited from ApplicationController

#gdpr_compliance

Instance Method Details

#createObject

POST /copies POST /copies.json



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/copies_controller.rb', line 42

def create
  @copy = Copy.new(copy_params)

  respond_to do |format|
    if @copy.save
      format.html { redirect_to @copy, notice: 'Copy was successfully created.' }
      format.json { render :show, status: :created, location: @copy }
    else
      format.html { render :new }
      format.json { render json: @copy.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /copies/1 DELETE /copies/1.json



72
73
74
75
76
77
78
# File 'app/controllers/copies_controller.rb', line 72

def destroy
  @copy.destroy
  respond_to do |format|
    format.html { redirect_to copies_url, notice: 'Copy was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /copies/1/edit



37
38
# File 'app/controllers/copies_controller.rb', line 37

def edit
end

#indexObject

GET /copies GET /copies.json



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/copies_controller.rb', line 7

def index
  
  binding_var = binding
  # render 'index', layout: false # §(FALSE_INSTEAD_OF_NIL_IS_ESSENTIAL) { false }
  #
  (AVOID_INFINITE_RECURSION, object: [self.class.instance_method(:index), :layout => nil]) do # heal
    §(LAYOUT_NIL_INTEGRAL_FOR_AVOIDING_INFINTE_RECURSION) do

      √?(CHANGE_HACKY_DUPLICATE_DEFINITION_OF_INSTANCE_VARIABLE, identifier: '@copies-for-copies/index-view', instance_variable: lambda { instance_variable_get(:@copies)} ) do
        @copies = 100.times.map { Copy.new }
      end

      §(NO_LAYOUT_EXPECTS_FALSE_INSTEAD_OF_NIL) do
        render('index', layout: §(FALSE_INSTEAD_OF_NIL_IS_ESSENTIAL) { false })
      end
    end
  end
end

#newObject

GET /copies/new



32
33
34
# File 'app/controllers/copies_controller.rb', line 32

def new
  @copy = Copy.new
end

#showObject

GET /copies/1 GET /copies/1.json



28
29
# File 'app/controllers/copies_controller.rb', line 28

def show
end

#updateObject

PATCH/PUT /copies/1 PATCH/PUT /copies/1.json



58
59
60
61
62
63
64
65
66
67
68
# File 'app/controllers/copies_controller.rb', line 58

def update
  respond_to do |format|
    if @copy.update(copy_params)
      format.html { redirect_to @copy, notice: 'Copy was successfully updated.' }
      format.json { render :show, status: :ok, location: @copy }
    else
      format.html { render :edit }
      format.json { render json: @copy.errors, status: :unprocessable_entity }
    end
  end
end