rails-conventions
Rails Conventions
This skill only covers what an agent got wrong without it in baseline tests. Everything else is standard Rails 8 practice, which the agent already follows. Where a project's own code or docs/conventions/ disagrees, follow the project.
Rules
-
Flash wording:
notice: 'Successfully Created Widget','Successfully Updated Widget','Successfully Deleted Widget'. Usealert:for failures. -
Failed saves:
render :new, status: :unprocessable_content, never:unprocessable_entity, which is the deprecated name for the same 422. -
Forms: always
simple_form_forandsimple_fields_for, neverform_withorform_for. Non-model forms use a symbol:simple_form_for :search, url: widgets_path, method: :get, which nests params under:search. -
Route concerns pass the parent type with
parent_resource.name.classify, not a hard-coded string or a concern option:concern :commentable do resources :comments, commentable_type: parent_resource.name.classify end