Class: GeographicAreasGeographicItemsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::SharedDataControllerConfiguration
Defined in:
app/controllers/geographic_areas_geographic_items_controller.rb

Overview

This class helps edit the relationships between GeographicAreas and GeographicItems

Constant Summary

Constants included from ProjectsHelper

ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION

Instance Method Summary collapse

Methods included from DataControllerConfiguration::SharedDataControllerConfiguration

#set_is_shared_data_model

Methods included from RedirectHelper

#destroy_redirect

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs

Methods included from Api::Intercept

#intercept_api

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#createObject

POST /geographic_areas_geographic_items POST /geographic_areas_geographic_items.json



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 18

def create
  @geographic_areas_geographic_item = GeographicAreasGeographicItem.new(geographic_areas_geographic_item_params)

  respond_to do |format|
    if @geographic_areas_geographic_item.save
      format.html { redirect_to @geographic_areas_geographic_item, notice: 'Geographic areas geographic item was successfully created.' }
      format.json { render action: 'show', status: :created, location: @geographic_areas_geographic_item }
    else
      format.html { render action: 'new' }
      format.json { render json: @geographic_areas_geographic_item.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /geographic_areas_geographic_items/1 DELETE /geographic_areas_geographic_items/1.json



48
49
50
51
52
53
54
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 48

def destroy
  @geographic_areas_geographic_item.destroy
  respond_to do |format|
    format.html { redirect_to geographic_areas_geographic_items_url }
    format.json { head :no_content }
  end
end

#editObject

GET /geographic_areas_geographic_items/1/edit



13
14
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 13

def edit
end

#geographic_areas_geographic_item_paramsObject (private)

Never trust parameters from the scary internet, only allow the white list through.



68
69
70
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 68

def geographic_areas_geographic_item_params
  params.require(:geographic_areas_geographic_item).permit(:geographic_area_id, :geographic_item_id, :data_origin, :origin_gid, :date_valid_from, :date_valid_to)
end

#newObject

GET /geographic_areas_geographic_items/new



8
9
10
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 8

def new
  @geographic_areas_geographic_item = GeographicAreasGeographicItem.new
end

#set_geographic_areas_geographic_itemObject (private)

Use callbacks to share common setup or constraints between actions.



63
64
65
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 63

def set_geographic_areas_geographic_item
  @geographic_areas_geographic_item = GeographicAreasGeographicItem.find(params[:id])
end

#updateObject

PATCH/PUT /geographic_areas_geographic_items/1 PATCH/PUT /geographic_areas_geographic_items/1.json



34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/geographic_areas_geographic_items_controller.rb', line 34

def update
  respond_to do |format|
    if @geographic_areas_geographic_item.update(geographic_areas_geographic_item_params)
      format.html { redirect_to @geographic_areas_geographic_item, notice: 'Geographic areas geographic item was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: 'edit' }
      format.json { render json: @geographic_areas_geographic_item.errors, status: :unprocessable_entity }
    end
  end
end