Class: TaggedSectionKeywordsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/tagged_section_keywords_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::ProjectDataControllerConfiguration

#polymorphic_filter_params

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



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/tagged_section_keywords_controller.rb', line 8

def create
  @tagged_section_keyword = TaggedSectionKeyword.new(tagged_section_keyword_params)

  respond_to do |format|
    if @tagged_section_keyword.save
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Tagged section keyword was successfully created.')}
      format.json {render json: @tagged_section_keyword, status: :created, location: @tagged_section_keyword}
    else
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Tagged section keyword was NOT successfully created.')}
      format.json {render json: @tagged_section_keyword.errors, status: :unprocessable_entity}
    end
  end
end

- (Object) destroy

DELETE /tagged_section_keywords/1 DELETE /tagged_section_keywords/1.json



38
39
40
41
42
43
44
# File 'app/controllers/tagged_section_keywords_controller.rb', line 38

def destroy
  @tagged_section_keyword.destroy
  respond_to do |format|
    format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Tagged section keyword was successfully destroyed.')}
    format.json {head :no_content}
  end
end

- (Object) set_tagged_section_keyword (private)

Use callbacks to share common setup or constraints between actions.



48
49
50
51
# File 'app/controllers/tagged_section_keywords_controller.rb', line 48

def set_tagged_section_keyword
  @tagged_section_keyword = TaggedSectionKeyword.with_project_id($project_id).find(params[:id])
  @recent_object          = @tagged_section_keyword
end

- (Object) tagged_section_keyword_params (private)

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



54
55
56
# File 'app/controllers/tagged_section_keywords_controller.rb', line 54

def tagged_section_keyword_params
  params.require(:tagged_section_keyword).permit(:otu_page_layout_section_id, :keyword_id)
end

- (Object) update

PATCH/PUT /tagged_section_keywords/1 PATCH/PUT /tagged_section_keywords/1.json



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/tagged_section_keywords_controller.rb', line 24

def update
  respond_to do |format|
    if @tagged_section_keyword.update(tagged_section_keyword_params)
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Tagged section keyword was successfully updated.')}
      format.json {render json: @tagged_section_keyword, status: :ok, location: @tagged_section_keyword}
    else
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Tagged section keyword was NOT successfully updated.')}
      format.json {render json: @tagged_section_keyword.errors, status: :unprocessable_entity}
    end
  end
end