Class: SerialChronologiesController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::SharedDataControllerConfiguration
Defined in:
app/controllers/serial_chronologies_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 /serial_chronologies POST /serial_chronologies.json



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

def create
  @serial_chronology = SerialChronology.new(serial_chronology_params)

  respond_to do |format|
    if @serial_chronology.save
      format.html { redirect_to :back, notice: 'Serial chronology was successfully created.' }
      format.json { render json: @serial_chronology, status: :created, location: @serial_chronology }
    else
      format.html { redirect_to :back, notice: 'Serial chronology was NOT successfully created.' }
      format.json { render json: @serial_chronology.errors, status: :unprocessable_entity }
    end
  end
end

- (Object) destroy

DELETE /serial_chronologies/1 DELETE /serial_chronologies/1.json



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

def destroy
  @serial_chronology.destroy
  respond_to do |format|
    format.html { redirect_to :back, notice: 'Serial chronology was successfully destroyed.' }
    format.json { head :no_content }
  end
end

- (Object) serial_chronology_params (private)

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



55
56
57
# File 'app/controllers/serial_chronologies_controller.rb', line 55

def serial_chronology_params
  params.require(:serial_chronology).permit(:preceding_serial_id, :succeeding_serial_id, :type)
end

- (Object) set_serial_chronology (private)

Use callbacks to share common setup or constraints between actions.



49
50
51
52
# File 'app/controllers/serial_chronologies_controller.rb', line 49

def set_serial_chronology
  @serial_chronology = SerialChronology.find(params[:id])
  @recent_object = @serial_chronology
end

- (Object) update

PATCH/PUT /serial_chronologies/1 PATCH/PUT /serial_chronologies/1.json



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

def update
  respond_to do |format|
    if @serial_chronology.update(serial_chronology_params)
      format.html { redirect_to :back, notice: 'Serial chronology was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { redirect_to :back, notice: 'Serial chronology was NOT successfully updated.' }
      format.json { render json: @serial_chronology.errors, status: :unprocessable_entity }
    end
  end
end