Class: GeographicAreaTypesController

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

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_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

- (Object) destroy

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

- (Object) edit

GET /geographic_area_types/1/edit



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

def edit
end

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

- (Object) index

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

- (Object) new

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

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

- (Object) show

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

- (Object) update

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