Class: CommonNamesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CommonNamesController
- Defined in:
- app/controllers/common_names_controller.rb
Instance Method Summary collapse
- #common_name_params ⇒ Object private
-
#create ⇒ Object
POST /common_names POST /common_names.json.
-
#destroy ⇒ Object
DELETE /common_names/1 DELETE /common_names/1.json.
-
#edit ⇒ Object
GET /common_names/1/edit.
-
#index ⇒ Object
GET /common_names GET /common_names.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /common_names/new.
- #set_common_name ⇒ Object private
-
#show ⇒ Object
GET /common_names/1 GET /common_names/1.json.
-
#update ⇒ Object
PATCH/PUT /common_names/1 PATCH/PUT /common_names/1.json.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
Methods included from RedirectHelper
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
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
#common_name_params ⇒ Object (private)
88 89 90 |
# File 'app/controllers/common_names_controller.rb', line 88 def common_name_params params.require(:common_name).permit(:name, :geographic_area_id, :otu_id, :language_id, :start_year, :end_year) end |
#create ⇒ Object
POST /common_names POST /common_names.json
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/common_names_controller.rb', line 44 def create @common_name = CommonName.new(common_name_params) respond_to do |format| if @common_name.save format.html { redirect_to @common_name, notice: 'Common name was successfully created.' } format.json { render :show, status: :created, location: @common_name } else format.html { render :new } format.json { render json: @common_name.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /common_names/1 DELETE /common_names/1.json
74 75 76 77 78 79 80 |
# File 'app/controllers/common_names_controller.rb', line 74 def destroy @common_name.destroy respond_to do |format| format.html { redirect_to common_names_url, notice: 'Common name was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /common_names/1/edit
35 36 |
# File 'app/controllers/common_names_controller.rb', line 35 def edit end |
#index ⇒ Object
GET /common_names GET /common_names.json
7 8 |
# File 'app/controllers/common_names_controller.rb', line 7 def index end |
#list ⇒ Object
38 39 40 |
# File 'app/controllers/common_names_controller.rb', line 38 def list @common_names = CommonName.with_project_id(sessions_current_project_id).page(params[:page]) #.per(10) end |
#new ⇒ Object
GET /common_names/new
30 31 32 |
# File 'app/controllers/common_names_controller.rb', line 30 def new @common_name = CommonName.new end |
#set_common_name ⇒ Object (private)
84 85 86 |
# File 'app/controllers/common_names_controller.rb', line 84 def set_common_name @common_name = CommonName.with_project_id(sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
GET /common_names/1 GET /common_names/1.json
26 27 |
# File 'app/controllers/common_names_controller.rb', line 26 def show end |
#update ⇒ Object
PATCH/PUT /common_names/1 PATCH/PUT /common_names/1.json
60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/common_names_controller.rb', line 60 def update respond_to do |format| if @common_name.update(common_name_params) format.html { redirect_to @common_name, notice: 'Common name was successfully updated.' } format.json { render :show, status: :ok, location: @common_name } else format.html { render :edit } format.json { render json: @common_name.errors, status: :unprocessable_entity } end end end |