Class: OriginRelationshipsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/origin_relationships_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 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 /origin_relationships POST /origin_relationships.json



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

def create
  @origin_relationship = OriginRelationship.new(origin_relationship_params)

  respond_to do |format|
    if @origin_relationship.save
      format.html { redirect_to @origin_relationship, notice: 'Origin relationship was successfully created.' }
      format.json { render :show, status: :created, location: @origin_relationship }
    else
      format.html { render :new }
      format.json { render json: @origin_relationship.errors, status: :unprocessable_entity }
    end
  end
end

- (Object) destroy

DELETE /origin_relationships/1 DELETE /origin_relationships/1.json



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

def destroy
  @origin_relationship.destroy
  respond_to do |format|
    format.html { redirect_to origin_relationships_url, notice: 'Origin relationship was successfully destroyed.' }
    format.json { head :no_content }
  end
end

- (Object) edit

GET /origin_relationships/1/edit



25
26
# File 'app/controllers/origin_relationships_controller.rb', line 25

def edit
end

- (Object) index

GET /origin_relationships GET /origin_relationships.json



9
10
11
12
# File 'app/controllers/origin_relationships_controller.rb', line 9

def index
  @recent_objects = OriginRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
  render '/shared/data/all/index'
end

- (Object) new

GET /origin_relationships/new



20
21
22
# File 'app/controllers/origin_relationships_controller.rb', line 20

def new
  @origin_relationship = OriginRelationship.new
end

- (Object) origin_relationship_params (private)

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



75
76
77
# File 'app/controllers/origin_relationships_controller.rb', line 75

def origin_relationship_params
  params.require(:origin_relationship).permit(:old_object_id, :old_object_type, :new_object_id, :new_object_type, :position, :created_by_id, :updated_by_id, :project_id)
end

- (Object) set_origin_relationship (private)

Use callbacks to share common setup or constraints between actions.



70
71
72
# File 'app/controllers/origin_relationships_controller.rb', line 70

def set_origin_relationship
  @origin_relationship = OriginRelationship.find(params[:id])
end

- (Object) show

GET /origin_relationships/1 GET /origin_relationships/1.json



16
17
# File 'app/controllers/origin_relationships_controller.rb', line 16

def show
end

- (Object) update

PATCH/PUT /origin_relationships/1 PATCH/PUT /origin_relationships/1.json



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

def update
  respond_to do |format|
    if @origin_relationship.update(origin_relationship_params)
      format.html { redirect_to @origin_relationship, notice: 'Origin relationship was successfully updated.' }
      format.json { render :show, status: :ok, location: @origin_relationship }
    else
      format.html { render :edit }
      format.json { render json: @origin_relationship.errors, status: :unprocessable_entity }
    end
  end
end