원클릭으로
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 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
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
| 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