mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 10:45:04 -04:00
* Paginate, 100 at a time * Limited i18n * Paginate roles * Pagination * Pagination * i18n and pagination * Paginate alternate names * Silence code climate * Rewrite coverage as a feature * Remove coverage in favour of crops/scientific_name_spec * Add missing admin link * Rewrite coverage as feature * Rewrite coverage --------- Co-authored-by: Brenda Wallace <brenda@wallace.net.nz>
45 lines
813 B
Ruby
45 lines
813 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PlantPartsController < ApplicationController
|
|
load_and_authorize_resource
|
|
respond_to :html, :json
|
|
responders :flash
|
|
|
|
def index
|
|
@plant_parts = PlantPart.all.order(:name).paginate(page: params[:page], per_page: 100)
|
|
respond_with(@plant_parts)
|
|
end
|
|
|
|
def show
|
|
respond_with(@plant_part)
|
|
end
|
|
|
|
def new
|
|
@plant_part = PlantPart.new
|
|
respond_with(@plant_part)
|
|
end
|
|
|
|
def edit; end
|
|
|
|
def create
|
|
@plant_part = PlantPart.create(plant_part_params)
|
|
respond_with(@plant_part)
|
|
end
|
|
|
|
def update
|
|
@plant_part.update(plant_part_params)
|
|
respond_with(@plant_part)
|
|
end
|
|
|
|
def destroy
|
|
@plant_part.destroy
|
|
respond_with(@plant_part)
|
|
end
|
|
|
|
private
|
|
|
|
def plant_part_params
|
|
params.require(:plant_part).permit(:name, :slug)
|
|
end
|
|
end
|