Class: Account::Scaffolding::CompletelyConcrete::TangibleThingsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things POST /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things.json



32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 32

def create
  respond_to do |format|
    if @tangible_thing.save
      format.html { redirect_to [:account, @tangible_thing], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.created") }
      format.json { render :show, status: :created, location: [:account, @tangible_thing] }
    else
      format.html { render :new, status: :unprocessable_entity }
      format.json { render json: @tangible_thing.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /account/scaffolding/completely_concrete/tangible_things/:id DELETE /account/scaffolding/completely_concrete/tangible_things/:id.json



60
61
62
63
64
65
66
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 60

def destroy
  @tangible_thing.destroy
  respond_to do |format|
    format.html { redirect_to [:account, @absolutely_abstract_creative_concept, :completely_concrete_tangible_things], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.destroyed") }
    format.json { head :no_content }
  end
end

#editObject

GET /account/scaffolding/completely_concrete/tangible_things/:id/edit



24
25
26
27
28
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 24

def edit
  # 🚅 skip this section when scaffolding.
  @tangible_thing.address_value ||= Address.new
  # 🚅 stop any skipping we're doing now.
end

#indexObject

GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things.json



6
7
8
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 6

def index
  delegate_json_to_api
end

#newObject

GET /account/scaffolding/absolutely_abstract/creative_concepts/:absolutely_abstract_creative_concept_id/completely_concrete/tangible_things/new



17
18
19
20
21
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 17

def new
  # 🚅 skip this section when scaffolding.
  @tangible_thing.address_value = Address.new
  # 🚅 stop any skipping we're doing now.
end

#showObject

GET /account/scaffolding/completely_concrete/tangible_things/:id GET /account/scaffolding/completely_concrete/tangible_things/:id.json



12
13
14
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 12

def show
  delegate_json_to_api
end

#updateObject

PATCH/PUT /account/scaffolding/completely_concrete/tangible_things/:id PATCH/PUT /account/scaffolding/completely_concrete/tangible_things/:id.json



46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb', line 46

def update
  respond_to do |format|
    if @tangible_thing.update(tangible_thing_params)
      format.html { redirect_to [:account, @tangible_thing], notice: I18n.t("scaffolding/completely_concrete/tangible_things.notifications.updated") }
      format.json { render :show, status: :ok, location: [:account, @tangible_thing] }
    else
      format.html { render :edit, status: :unprocessable_entity }
      format.json { render json: @tangible_thing.errors, status: :unprocessable_entity }
    end
  end
end