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

Instance Attribute Summary

Attributes inherited from ApplicationController

#is_data_controller, #is_task_controller, #meta_data, #meta_description, #meta_keywords, #meta_title, #page_title, #site_name

Instance Method Summary (collapse)

Methods included from DataControllerConfiguration::SharedDataControllerConfiguration

#set_is_shared_data_model

Methods inherited from ApplicationController

#clear_project_and_user_variables, #digest_cookie, #digested_cookie_exists?, #disable_turbolinks, #intercept_api, #invalid_object, #is_data_controller?, #is_task_controller?, #log_user_recent_route, #notice_user, #project_matches, #record_not_found, #set_project_and_user_variables, #set_project_from_params, #token_authenticate

Methods included from ProjectsHelper

#project_link, #project_tag, #projects_list, #projects_search_form

Instance Method Details

- (Object) create

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

- (Object) destroy

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

- (Object) edit

GET /geographic_areas_geographic_items/1/edit



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

def edit
end

- (Object) geographic_areas_geographic_item_params (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

- (Object) new

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

- (Object) set_geographic_areas_geographic_item (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

- (Object) update

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