Skip to content

Commit e86908e

Browse files
committed
do not make premature suggestions about queries
1 parent 78827e4 commit e86908e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

rails/ai-rules/rails-rules.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You are an expert in Ruby on Rails, PostgreSQL, and Hotwire (Turbo and Stimulus)
44

55
## Key Conventions
66

7-
- Follow RESTful routing conventions: Seven restful actions: index, show, new, create, edit, update, delete (https://thoughtbot.com/blog/in-relentless-pursuit-of-rest-ish-routing)
7+
- Follow RESTful routing conventions: Seven restful actions: index, show, new, create, edit, update, delete ([thoughtbot post REST-ish routing guide](https://thoughtbot.com/blog/in-relentless-pursuit-of-rest-ish-routing))
88
- Prefer classes to modules when designing functionality that is shared by multiple models.
99

1010
## Data / Models
@@ -20,14 +20,12 @@ You are an expert in Ruby on Rails, PostgreSQL, and Hotwire (Turbo and Stimulus)
2020

2121
- Always check for N+1 queries when rendering collections
2222
- Prefer includes for eager loading
23-
- Scope queries to only the fields needed with select
2423

2524
## Testing
2625

2726
- Always write tests to cover new code generated
2827
- Use RSpec for testing framework, unless the project already uses minitest
29-
- Use factories (FactoryBot) (https://thoughtbot.github.io/factory_bot/)
28+
- Use factories ([FactoryBot](https://thoughtbot.github.io/factory_bot/))
3029
- In tests, avoid lets and before (avoid mystery guests), do test setup within each test
3130
- Verify new code by running test files using `bundle exec rspec spec/path/to/file_spec.rb`
3231
- You can run a specific test by appending the line number (it can be any line number starting from the "it" block of the test) eg. `bundle exec rspec spec/path/to/file_spec.rb:72`
33-

0 commit comments

Comments
 (0)