Class: CombinationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CombinationsController
- Defined in:
- app/controllers/combinations_controller.rb
Instance Method Summary collapse
- #combination_params ⇒ Object private
-
#create ⇒ Object
POST /combinations.json.
-
#destroy ⇒ Object
DELETE /combinations/1 DELETE /combinations/1.json.
-
#edit ⇒ Object
GET /combinations/1/edit.
-
#index ⇒ Object
GET /combinations.json.
-
#new ⇒ Object
GET /combinations/new.
- #set_combination ⇒ Object private
-
#show ⇒ Object
GET /combinations/123.json.
-
#update ⇒ Object
PATCH/PUT /combinations/1 PATCH/PUT /combinations/1.json.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
Methods included from ProjectsHelper
#invalid_object, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form
Methods included from Api::Intercept
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#combination_params ⇒ Object (private)
70 71 72 73 74 75 76 |
# File 'app/controllers/combinations_controller.rb', line 70 def combination_params params.require(:combination).permit( :verbatim_name, :source_id, *Combination::APPLICABLE_RANKS.collect{|r| "#{r}_id".to_sym}, origin_citation_attributes: [:id, :_destroy, :source_id, :pages], ) end |
#create ⇒ Object
POST /combinations.json
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/combinations_controller.rb', line 27 def create @combination = Combination.new(combination_params) respond_to do |format| if @combination.save format.html { redirect_to taxon_names_path, notice: 'Combination was successfully created.' } format.json { render :show, status: :created, location: @combination. } else format.html { render :new } format.json { render json: @combination.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /combinations/1 DELETE /combinations/1.json
56 57 58 59 60 61 62 |
# File 'app/controllers/combinations_controller.rb', line 56 def destroy @combination.destroy respond_to do |format| format.html { redirect_to taxon_names_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /combinations/1/edit
22 23 24 |
# File 'app/controllers/combinations_controller.rb', line 22 def edit redirect_to new_combination_task_path(params.require(:id)) end |
#index ⇒ Object
GET /combinations.json
8 9 10 |
# File 'app/controllers/combinations_controller.rb', line 8 def index @recent_objects = Combination.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(5) end |
#new ⇒ Object
GET /combinations/new
17 18 19 |
# File 'app/controllers/combinations_controller.rb', line 17 def new redirect_to new_combination_task_path(params.permit(:id)) end |
#set_combination ⇒ Object (private)
65 66 67 68 |
# File 'app/controllers/combinations_controller.rb', line 65 def set_combination @combination = Combination.with_project_id(sessions_current_project_id).find(params.require(:id)) @recent_object = @combination end |
#show ⇒ Object
GET /combinations/123.json
13 14 |
# File 'app/controllers/combinations_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /combinations/1 PATCH/PUT /combinations/1.json
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/combinations_controller.rb', line 42 def update respond_to do |format| if @combination.update(combination_params) format.html { redirect_to url_for(@combination.), notice: 'Combination was successfully updated.' } format.json { render :show, status: :ok, location: @combination. } else format.html { render :edit } format.json { render json: @combination.errors, status: :unprocessable_entity } end end end |