ワンクリックで
rails-controllers
Controller patterns, service delegation, strong parameters, and HTTP conventions for this Rails codebase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Controller patterns, service delegation, strong parameters, and HTTP conventions for this Rails codebase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Create, execute, update, and complete implementation plans and trackers following Linkvan API conventions
Standardized Ruby gem update workflow with version checking, breaking change analysis, security advisory detection, and testing
RuboCop metrics, Brakeman security, code style conventions, and quality checks for this Rails codebase
Database migration patterns, reversible migrations, indexes, and conventions for this Rails codebase
ActiveRecord model patterns, validations, scopes, and conventions for this Rails codebase
RSpec testing patterns, conventions, and test commands for this Rails codebase
SOC 職業分類に基づく
| name | rails-controllers |
| description | Controller patterns, service delegation, strong parameters, and HTTP conventions for this Rails codebase |
FacilitiesController)facilities_controller.rbapp/controllers/ directorydef create
result = FacilityCreateService.call(facility_params)
if result.errors.any?
render json: { errors: result.errors }, status: :unprocessable_content
else
render json: result.data, status: :created
end
end
before_action for shared logic:
before_action :authenticate_user!
before_action :set_facility, only: [:show, :update, :destroy]
def facility_params
params.require(:facility).permit(:name, :address, :status)
end
def nested_params
params.require(:facility).permit(:name, bookings_attributes: [:id, :date, :_destroy])
end
200 OK - Successful GET/PUT/PATCH201 Created - Successful POST204 No Content - Successful DELETE400 Bad Request - Invalid request401 Unauthorized - Not authenticated403 Forbidden - Not authorized404 Not Found - Resource not found422 Unprocessable Content - Validation errors500 Internal Server Error - Server error# JSON response
render json: @facility
# JSON with status
render json: @facility, status: :ok
# JSON with errors
render json: { errors: ["Validation failed"] }, status: :unprocessable_content
# Redirect
redirect_to @facility, notice: "Success"
# Render template
render :new
spec/controllers/*_controller_spec.rb suffixclass FacilitiesController < ApplicationController
before_action :authenticate_user!
before_action :set_facility, only: [:show, :update, :destroy]
def index
@facilities = Facility.all
render json: @facilities
end
def show
render json: @facility
end
def create
result = FacilityCreateService.call(facility_params)
if result.errors.any?
render json: { errors: result.errors }, status: :unprocessable_content
else
render json: result.data, status: :created
end
end
private
def set_facility
@facility = Facility.find(params[:id])
end
def facility_params
params.require(:facility).permit(:name, :address, :status)
end
end