▸case-01 I have a Rails 7 controller action rendering `@posts = Post.all`, and in the view I loop through `@posts` and call `post.author.name` on each post. This triggers dozens of SQL queries. Provide a Rails 7 Active Record query that resolves this performance bottleneck. | pass→pass | 4,748 | 4,905 | +3% | 1 | 1 | 0% | 815 | 1,051 | +29% | 0 | 0 | — |
▸case-02 I need to update a status flag on 100,000 `User` records in a Rails 7 maintenance script. Running `User.all.each` causes memory usage to spike and crash the worker. Provide a Rails 7 Active Record approach to process these records safely in batches. | pass→pass | 10,359 | 9,438 | -9% | 1 | 1 | 0% | 1,846 | 1,817 | -2% | 0 | 0 | — |
▸case-03 I need to extract an array containing only the `email` strings for 50,000 users in a Rails 7 task. Using `User.all.map(&:email)` instantiates thousands of Active Record objects and consumes hundreds of megabytes. Provide the Active Record query that fetches only the email column values directly from the database. | pass→pass | 5,236 | 4,727 | -10% | 1 | 1 | 0% | 919 | 1,025 | +12% | 0 | 0 | — |
▸case-04 I need to check whether a `Customer` has any active subscriptions in a Rails 7 validation method without loading the entire collection of subscriptions into Ruby memory. Using `customer.subscriptions.active.present?` or `customer.subscriptions.active.count > 0` is inefficient. Write the Active Record relation query for this check. | pass→pass | 8,374 | 6,125 | -27% | 1 | 1 | 0% | 1,494 | 1,201 | -20% | 0 | 0 | — |
▸case-05 I want to catch lazy loading association bugs early in development across my Rails 7 application by raising an error whenever an un-eager-loaded association is accessed. Show how to enable this protection on the User model in Rails 7. | pass→pass | 8,048 | 7,137 | -11% | 1 | 1 | 0% | 1,609 | 1,638 | +2% | 0 | 0 | — |
▸case-06 In a Rails 7 application, when a user submits a new comment form, I want to append the newly rendered comment to the `<div id='comments'>` container instantly via HTTP response without replacing the whole page or writing custom JavaScript fetch handlers. Provide the Rails Turbo Stream view template snippet. | pass→pass | 4,688 | 4,630 | -1% | 1 | 1 | 0% | 916 | 1,047 | +14% | 0 | 0 | — |
▸case-07 I have a heavy analytics dashboard section on a Rails 7 view page that slows down initial page load. I want the main page to render instantly and load the analytics block asynchronously after initial page load. Provide the Rails view helper code for lazy-loading this section. | pass→pass | 10,288 | 9,275 | -10% | 1 | 1 | 0% | 1,629 | 1,484 | -9% | 0 | 0 | — |
▸case-08 In a Rails 7 model `Message` belonging to `room`, I want new messages to automatically broadcast to all clients viewing that room over WebSockets as soon as a message is created, without writing manual channel dispatch code. Show the Active Record model callback helper. | pass→pass | 7,278 | 8,668 | +19% | 1 | 1 | 0% | 1,351 | 1,691 | +25% | 0 | 0 | — |
▸case-09 Inside a Turbo Frame on a Rails 7 page, a user clicks a 'Sign Out' link. By default, Turbo tries to replace the content inside the frame with the login page. Provide the link option required to make the browser perform a full-window page redirection to the login page. | fail→fail | 4,952 | 2,971 | -40% | 1 | 1 | 0% | 937 | 774 | -17% | 0 | 0 | — |
▸case-10 In a Rails 7 Action Cable channel named `ChatRoomChannel`, I want to stream messages specific to a given `Room` model instance passed in `params[:room_id]`. Show the `subscribed` method implementation inside the channel. | pass→pass | 4,772 | 4,619 | -3% | 1 | 1 | 0% | 924 | 991 | +7% | 0 | 0 | — |
▸case-11 In a Rails 7 Action Cable `ApplicationCable::Connection` setup, I need to authenticate connecting WebSocket clients using signed session cookies and reject unauthorized connections before they open channels. Provide the authentication logic inside `connect`. | pass→pass | 12,747 | 7,243 | -43% | 1 | 1 | 0% | 2,606 | 1,615 | -38% | 0 | 0 | — |
▸case-12 I need to create an asynchronous background job in Rails 7 to process user data exports. The job must adhere to modern Sidekiq practices. Show the job class definition structure. | pass→pass | 12,480 | 8,587 | -31% | 1 | 1 | 0% | 2,434 | 1,748 | -28% | 0 | 0 | — |
▸case-13 I have a `SendWeeklyDigestJob` class in a Rails 7 application. Show how to schedule this job to execute 2 hours in the future for user ID 42. | fail→fail | 5,598 | 4,246 | -24% | 1 | 1 | 0% | 1,102 | 939 | -15% | 0 | 0 | — |
▸case-14 When enqueuing a background job to process order #108 in Rails 7, passing the full `Order` Active Record object like `ProcessOrderJob.perform_async(order)` causes Redis serialization errors and stale data issues. Write the corrected enqueueing call. | pass→pass | 4,017 | 5,048 | +26% | 1 | 1 | 0% | 750 | 1,070 | +43% | 0 | 0 | — |
▸case-15 I have a background job in Rails 7 that sends one-time SMS verification codes. If it fails once, retrying it later is useless and annoying to users. Show how to disable automatic retries inside the job class definition. | fail→pass | 8,563 | 9,139 | +7% | 1 | 1 | 0% | 1,530 | 1,428 | -7% | 0 | 0 | — |
▸case-16 I want to test a Rails 7 API endpoint `POST /api/v1/posts` using RSpec. The spec should send JSON parameters and verify that the endpoint returns an HTTP status of 201 Created. Write the RSpec spec block. | pass→pass | 4,986 | 4,904 | -2% | 1 | 1 | 0% | 1,049 | 1,208 | +15% | 0 | 0 | — |
▸case-17 I need to write an RSpec model test for a `User` model in Rails 7 ensuring that a user without an email address is invalid and contains an error on the email attribute. Write the RSpec test case. | pass→pass | 4,784 | 5,045 | +5% | 1 | 1 | 0% | 999 | 967 | -3% | 0 | 0 | — |
▸case-18 I am writing an RSpec system spec in Rails 7 to test a client-side JavaScript modal interaction. I want the browser test to run in headless Chrome without opening a visible browser GUI window. Show the driver setup configuration for the spec. | pass→pass | 10,319 | 10,403 | +1% | 1 | 1 | 0% | 2,111 | 1,802 | -15% | 0 | 0 | — |
▸case-19 In a Rails 7 application using FactoryBot and RSpec, I have an `Article` model that `belongs_to :author`. Show how to define the `Article` factory so that creating an article automatically generates an associated author record. | pass→pass | 7,545 | 7,080 | -6% | 1 | 1 | 0% | 1,564 | 1,485 | -5% | 0 | 0 | — |
▸case-20 In an Elixir Phoenix Web application, I need to create a real-time `RoomChannel` that handles incoming `'new_msg'` events and broadcasts them to all topic subscribers. Show the Elixir channel implementation. | pass→pass | 7,858 | 6,665 | -15% | 1 | 1 | 0% | 1,226 | 1,349 | +10% | 0 | 0 | — |
▸case-21 In a Python Django web application, I am getting N+1 database queries when iterating over `Book` records and accessing `book.author.name` in a view. Show how to fix this using Django ORM QuerySet optimization. | pass→pass | 7,244 | 5,963 | -18% | 1 | 1 | 0% | 1,386 | 1,345 | -3% | 0 | 0 | — |
▸case-22 In a Rails application deployed to production, I need to configure worker process counts and thread pool sizing in `config/puma.rb` to handle concurrency. Provide the Puma configuration file directives. | pass→pass | 10,445 | 8,488 | -19% | 1 | 1 | 0% | 2,048 | 1,661 | -19% | 0 | 0 | — |
▸case-23 In Rails 7.1+, I have an `OrderProduct` model representing a join table with composite primary keys `order_id` and `product_id`. Show how to declare composite primary keys natively in the Active Record model class. | pass→pass | 5,987 | 4,868 | -19% | 1 | 1 | 0% | 1,117 | 1,125 | +1% | 0 | 0 | — |