Class: RangedLotCategoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RangedLotCategoriesController
- Defined in:
- app/controllers/ranged_lot_categories_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
-
#create ⇒ Object
POST /ranged_lot_categories POST /ranged_lot_categories.json.
-
#destroy ⇒ Object
DELETE /ranged_lot_categories/1 DELETE /ranged_lot_categories/1.json.
-
#download ⇒ Object
GET /ranged_lot_categories/download.
-
#edit ⇒ Object
GET /ranged_lot_categories/1/edit.
-
#index ⇒ Object
GET /ranged_lot_categories GET /ranged_lot_categories.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /ranged_lot_categories/new.
-
#ranged_lot_category_params ⇒ Object
private
Never trust parameters from the scary internet, only allow the white list through.
-
#set_ranged_lot_category ⇒ Object
private
Use callbacks to share common setup or constraints between actions.
-
#show ⇒ Object
GET /ranged_lot_categories/1 GET /ranged_lot_categories/1.json.
-
#update ⇒ Object
PATCH/PUT /ranged_lot_categories/1 PATCH/PUT /ranged_lot_categories/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 ProjectsHelper
#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs
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
#create ⇒ Object
POST /ranged_lot_categories POST /ranged_lot_categories.json
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 29 def create @ranged_lot_category = RangedLotCategory.new(ranged_lot_category_params) respond_to do |format| if @ranged_lot_category.save format.html { redirect_to @ranged_lot_category, notice: 'Ranged lot category was successfully created.' } format.json { render :show, status: :created, location: @ranged_lot_category } else format.html { render :new } format.json { render json: @ranged_lot_category.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /ranged_lot_categories/1 DELETE /ranged_lot_categories/1.json
59 60 61 62 63 64 65 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 59 def destroy @ranged_lot_category.destroy respond_to do |format| format.html { redirect_to ranged_lot_categories_url } format.json { head :no_content } end end |
#download ⇒ Object
GET /ranged_lot_categories/download
72 73 74 75 76 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 72 def download send_data(Export::CSV.generate_csv(RangedLotCategory.where(project_id: sessions_current_project_id)), type: 'text', filename: "ranged_lot_categories_#{DateTime.now}.tsv") end |
#edit ⇒ Object
GET /ranged_lot_categories/1/edit
24 25 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /ranged_lot_categories GET /ranged_lot_categories.json
8 9 10 11 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 8 def index @recent_objects = RangedLotCategory.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' end |
#list ⇒ Object
67 68 69 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 67 def list @ranged_lot_categories = RangedLotCategory.with_project_id(sessions_current_project_id).order(:id).page(params[:page]) end |
#new ⇒ Object
GET /ranged_lot_categories/new
19 20 21 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 19 def new @ranged_lot_category = RangedLotCategory.new end |
#ranged_lot_category_params ⇒ Object (private)
Never trust parameters from the scary internet, only allow the white list through.
88 89 90 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 88 def ranged_lot_category_params params.require(:ranged_lot_category).permit(:name, :minimum_value, :maximum_value) end |
#set_ranged_lot_category ⇒ Object (private)
Use callbacks to share common setup or constraints between actions.
82 83 84 85 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 82 def set_ranged_lot_category @ranged_lot_category = RangedLotCategory.with_project_id(sessions_current_project_id).find(params[:id]) @recent_object = @ranged_lot_category end |
#show ⇒ Object
GET /ranged_lot_categories/1 GET /ranged_lot_categories/1.json
15 16 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /ranged_lot_categories/1 PATCH/PUT /ranged_lot_categories/1.json
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/ranged_lot_categories_controller.rb', line 45 def update respond_to do |format| if @ranged_lot_category.update(ranged_lot_category_params) format.html { redirect_to @ranged_lot_category, notice: 'Ranged lot category was successfully updated.' } format.json { render :show, status: :ok, location: @ranged_lot_category } else format.html { render :edit } format.json { render json: @ranged_lot_category.errors, status: :unprocessable_entity } end end end |