Initial app
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-14 15:36:05 +01:00
parent 8e9bf30547
commit 50280ce389
136 changed files with 3127 additions and 60 deletions

View File

@@ -0,0 +1,38 @@
class PuzzlesController < ApplicationController
before_action :set_puzzle, only: %i[ show destroy ]
def index
@puzzles = Puzzle.all
end
def show
end
def new
@puzzle = Puzzle.new
end
def create
@puzzle = Puzzle.new(puzzle_params)
if @puzzle.save
redirect_to @puzzle
else
render :new, status: :unprocessable_entity
end
end
def destroy
@puzzle.destroy
redirect_to puzzles_path
end
private
def set_puzzle
@puzzle = Puzzle.find(params[:id])
end
def puzzle_params
params.expect(puzzle: [ :name, :image ])
end
end