Class: GeographicAreaTypesController

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

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_area_types POST /geographic_area_types.json



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/geographic_area_types_controller.rb', line 29

def create
  @geographic_area_type = GeographicAreaType.new(geographic_area_type_params)
  @geographic_area_type.created_by_id = sessions_current_user.id
  @geographic_area_type.updated_by_id = sessions_current_user.id

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

#destroyObject

DELETE /geographic_area_types/1 DELETE /geographic_area_types/1.json



61
62
63
64
65
66
67
# File 'app/controllers/geographic_area_types_controller.rb', line 61

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

#editObject

GET /geographic_area_types/1/edit



24
25
# File 'app/controllers/geographic_area_types_controller.rb', line 24

def edit
end

#geographic_area_type_paramsObject (private)

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



77
78
79
# File 'app/controllers/geographic_area_types_controller.rb', line 77

def geographic_area_type_params
  params.require(:geographic_area_type).permit(:name)
end

#indexObject

GET /geographic_area_types GET /geographic_area_types.json



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

def index
  @geographic_area_types = GeographicAreaType.all
  render '/shared/data/all/index'
end

#newObject

GET /geographic_area_types/new



19
20
21
# File 'app/controllers/geographic_area_types_controller.rb', line 19

def new
  @geographic_area_type = GeographicAreaType.new
end

#set_geographic_area_typeObject (private)

Use callbacks to share common setup or constraints between actions.



71
72
73
74
# File 'app/controllers/geographic_area_types_controller.rb', line 71

def set_geographic_area_type
  @geographic_area_type = GeographicAreaType.find(params[:id])
  @recent_object = @geographic_area_type 
end

#showObject

GET /geographic_area_types/1 GET /geographic_area_types/1.json



15
16
# File 'app/controllers/geographic_area_types_controller.rb', line 15

def show
end

#updateObject

PATCH/PUT /geographic_area_types/1 PATCH/PUT /geographic_area_types/1.json



47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/geographic_area_types_controller.rb', line 47

def update
  respond_to do |format|
    if @geographic_area_type.update(geographic_area_type_params)
      format.html { redirect_to @geographic_area_type, notice: 'Geographic area type was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: 'edit' }
      format.json { render json: @geographic_area_type.errors, status: :unprocessable_entity }
    end
  end
end