Class: GeneAttributesController

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



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/gene_attributes_controller.rb', line 33

def create
  @gene_attribute = GeneAttribute.new(gene_attribute_params)

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

- (Object) destroy

DELETE /gene_attributes/1 DELETE /gene_attributes/1.json



71
72
73
74
75
76
77
# File 'app/controllers/gene_attributes_controller.rb', line 71

def destroy
  @gene_attribute.destroy
  respond_to do |format|
    format.html { redirect_to gene_attributes_url, notice: 'Gene attribute was successfully destroyed.' }
    format.json { head :no_content }
  end
end

- (Object) edit

GET /gene_attributes/1/edit



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

def edit
end

- (Object) gene_attribute_params (private)

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



86
87
88
# File 'app/controllers/gene_attributes_controller.rb', line 86

def gene_attribute_params
  params.require(:gene_attribute).permit(:descriptor_id, :sequence_id, :sequence_relationship_type, :controlled_vocabulary_term_id, :position, :created_by_id, :updated_by_id, :project_id)
end

- (Object) index

GET /gene_attributes GET /gene_attributes.json



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

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

- (Object) list



27
28
29
# File 'app/controllers/gene_attributes_controller.rb', line 27

def list
  @gene_attributes = GeneAttribute.with_project_id(sessions_current_project_id).page(params[:page])
end

- (Object) new

GET /gene_attributes/new



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

def new
  @gene_attribute = GeneAttribute.new
end

- (Object) search



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

def search
  if params[:id].blank?
    redirect_to gene_attributes_path, notice: 'You must select an item from the list with a click or tab before clicking show.'
  else
    redirect_to gene_attribute_path(params[:id])
  end
end

- (Object) set_gene_attribute (private)

Use callbacks to share common setup or constraints between actions.



81
82
83
# File 'app/controllers/gene_attributes_controller.rb', line 81

def set_gene_attribute
  @gene_attribute = GeneAttribute.find(params[:id])
end

- (Object) show

GET /gene_attributes/1 GET /gene_attributes/1.json



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

def show
end

- (Object) update

PATCH/PUT /gene_attributes/1 PATCH/PUT /gene_attributes/1.json



49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/gene_attributes_controller.rb', line 49

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