make own dummy, less confusing what is gem/engine and what is app
This commit is contained in:
2
dummy/app/controllers/application_controller.rb
Normal file
2
dummy/app/controllers/application_controller.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
end
|
0
dummy/app/controllers/concerns/.keep
Normal file
0
dummy/app/controllers/concerns/.keep
Normal file
58
dummy/app/controllers/images_controller.rb
Normal file
58
dummy/app/controllers/images_controller.rb
Normal file
@ -0,0 +1,58 @@
|
||||
class ImagesController < ApplicationController
|
||||
before_action :set_image, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /images
|
||||
def index
|
||||
@images = Image.all
|
||||
end
|
||||
|
||||
# GET /images/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /images/new
|
||||
def new
|
||||
@image = Image.new
|
||||
end
|
||||
|
||||
# GET /images/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /images
|
||||
def create
|
||||
@image = Image.new(image_params)
|
||||
|
||||
if @image.save
|
||||
redirect_to @image, notice: "Image was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /images/1
|
||||
def update
|
||||
if @image.update(image_params)
|
||||
redirect_to @image, notice: "Image was successfully updated."
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /images/1
|
||||
def destroy
|
||||
@image.destroy
|
||||
redirect_to images_url, notice: "Image was successfully destroyed."
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_image
|
||||
@image = Image.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def image_params
|
||||
params.fetch(:image, {})
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user