Tom Dringer


2,690 Experience
12 Lessons Completed
1 Question Solved


Hi, I've searched this site, Googled etc, but can anyone recommend a good RSpec tutorial? Thanks.

Posted in How to add Search in Rails using Meilisearch Discussion

Another question. What's the best way to integrate pagy_search in to my index if I'm already using Pagy? In my controller I currently have:

def index

    @gold_drivers = Driver.gold_plan
    @silver_drivers = Driver.silver_plan
    @free_drivers = Driver.free_plan

    @pagy, @drivers = pagy_array(
      @gold_drivers + @silver_drivers + @free_drivers,
      page: params[:page],
      items: 16

    if params[:query].present?
      @drivers = @gold_drivers + @silver_drivers + @free_drivers
      drivers_search = Driver.pagy_search(params[:query])
      @pagy, @drivers = pagy_meilisearch(drivers_search, items: 25, page: params[:page])

I have a Driver model which delegate's to a Profile model. Unfortunately when I click search I get Driver#first_name delegated to profile.first_name, but profile is nil: #<Driver id: 224... as I know this driver does not have a profile, but the query run for @gold_drivers = Driver.gold_plan / @silver_drivers = Driver.silver_plan etc should not select a driver without a profile.

The query behind Driver.gold_plan is:

find_by_sql("SELECT drivers.*, (profiles.no_races + profiles.no_poles + profiles.no_podiums + profiles.no_wins)       AS scores FROM drivers INNER JOIN profiles ON profiles.driver_id = INNER JOIN subscriptions ON     subscriptions.driver_id = WHERE subscriptions.status = 'active' AND profiles.first_name != null OR     profiles.first_name != '' AND subscriptions.stripe_plan = '#{ENV["GOLD_ANNUAL"]}' OR subscriptions.stripe_plan =     '#{ENV["GOLD_MONTH"]}' GROUP BY scores, ORDER BY scores DESC")

In that query I'm using "AND profiles.first_name != null OR profiles.first_name != ''" which works in the pagy_page section - but not in the pagy_search section.

Any direction with this is appreciated!

Posted in How to use Uppy with ActiveStorage Discussion

Yeah I've put this on the back burner for now. I'll see if I need to come back to it.

Posted in How to add Search in Rails using Meilisearch Discussion

Thanks for another great video! If I had a profile model that was inverse of the user model, would I have to do things different? Thanks

Posted in Upgrading to Rails 7

Hi everyone,

I had a rails 6.1 app and thought I'd upgrade it to Rails 7 to enjoy the new features. I thought moving from 6.1 to 7 would be fairly straight forward, as I know there's people upgrading from v5 to 7.
Long story short, I'm finding it a complete mess with issue after issue, which has so far been mostly with Devise. For instance, current_user.column_name is not found.
Are there any decent tutorials out there for the upgrade? I was using the official documentation, but I think I will need more to read up on.


Posted in Submit a form from different page

Hi everyone,

Hope everyone is well. I have a Driver form (which is basically the user - I can do current_driver and stuff) and one of the fields is a boolean checkbox for 'subscribe to newsletter'.
I want to put this form on multiple pages that do not share the same controller, i.e Dashboard which has a pages controller.
I am using a partial to do this so i can just add the partial to a template easily.
I believe that the form should post to edit_driver_path as it's the driver form? At the moment when i submit the form, I get "No route matches [POST] "/drivers/dashboard/edit".

Am I on the right path here?

Let me know if i need to post controllers, forms or whatever.


Posted in How to use Uppy with ActiveStorage Discussion

What did you end up with in the end? I'm working on getting S3 up-and-running but trying to understand the companion side of things

Posted in How to use Uppy with ActiveStorage Discussion

If anyone else gets this error, it's a Babel configuration issue. I ended up using the babel config file from the tutorial.

Posted in How to use Uppy with ActiveStorage Discussion

Straight out the box i'm having issues with Uppy. I get the following error index.js:2209 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' I have Googled this, and It's to do with the way the the functions in index.js are exported. It's asking that they are exported using export default rather than module.exports xxx. Is there any way around this? Obviously, it's not good practice to modify files in node_modules. Thanks

Posted in What's the best way to debug Amazon S3 errors

Hi everyone,

So far in my rails journey, the most frustrating thing by far has been using Amazon S3 for storage. I have had various issues, all without error messages, which is like looking for a needle in a haystack.
How do you debug issues with Amazon S3? For instance at the moment, development shows some images and not all, on my staging server no images are displayed, and production currently shows all images. When I use the browser tools no address for the image is even loaded:

<div class="card-img" variant="top" itemprop="image" title="The racing machine driven by joe blogs" style="background: url(< nothing >) no-repeat; background-size: cover">

I am looking to deploy some big changes to production, but don't feel confident with missing images.

On a side note, I recently upgraded my rails version and my active storage versions, running the migrations and adding the service column to the blobs table. I'm hoping maybe I made some sort of error in the migration.

Please let me know your experiences with Amazon S3. Thanks!

Posted in Rails 6.1 Active Text Javascript errors

I am making an article section in my Rails app. For this reason I thought Active Text would be a good idea. I have added it as per the Rails Guides as per but when i try to upload an image i get the following errors:

Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)

and also

Uncaught Error: Direct upload failed: Error creating Blob for "foxes.jpg". Status: 422
at AttachmentUpload.directUploadDidComplete (attachment_upload.js:37)
at BlobRecord.callback (activestorage.js:875)
at BlobRecord.requestDidError (activestorage.js:760)
at BlobRecord.requestDidLoad (activestorage.js:754)
at XMLHttpRequest.<anonymous> (activestorage.js:728)

This seems to happen on every environment apart from development. I am also using AWS S3 and Cloudfront and i think the settings are all good for that.

Anyone else tried ActiveText, S3 and Cloudfront?


Hi, I am having to use a different computer whilst mine is in for repair. So i generated the SSH keys to be used for deployment with Hatchbox. Using deploy@x.x.x.x or root@x.x.x.x just gives me an error Permission denied (publickey). Does anyone know a fix for this? I am locked out of my server and i desperately need to check the logs for an error which is giving me a white screen of death. Thanks

Posted in Space Upgrades - A browser game made in Rails

Wow thats awesome!

Posted in Order by score using Pagy pagination?

@joshBrody - just check default scope is only going to be in the model or the controller i guess?

Posted in Order by score using Pagy pagination?

I've just checked and i don't have default scope anywhere

Posted in Order by score using Pagy pagination?

Hi everyone. I am currently trying to order some ActiveRecord records by score. In my controller i have:

def index
    @pagy, @drivers = pagy(
            '(drivers.no_races + drivers.no_poles + drivers.no_podiums + drivers.no_wins) AS score'
        ).reorder('drivers.score DESC'),
        page: params[:page],
        items: 16

I am using Pagy for the pagination. As the code shows, I do a query to select all drivers and then add together 3 columns in the table as 'score'. I then want to order by score going from high to low and show 16 records per page.
When the page loads it seems to order by driver id. I can't see anywhere else that i have an order by, but i did add reorder to override anything else.
Anyway for whatever reason i'm stuck with the wrong ordering. Any direction is appreciated :-)

Mockup -

Posted in Hatchbox deployment. public/index.html not found

Ok i made a staging enviroment in my app, which i guess could be the issue. I have environment variables on Hatchbox using staging, rather than p[roduction. I'll dig deeper. Thanks

Posted in Hatchbox deployment. public/index.html not found

Cool can i set this somewhere? My path should be pretty default. Its just app/

Posted in Hatchbox deployment. public/index.html not found


I am deploying to hatchbox and everything appears fine until i load the site up in the browser. Looking at the logs there is no public/index.html. On my development environment there is also no index file in public. I am using Rails 6 which apparently doesn't build a public index.html file?

Posted in Postgres issues

I now have Postgres running on my local machine nicely. My issue now is i can't run a migration due to the following error:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "drivers" does not exist
LINE 8: WHERE a.attrelid = '"drivers"'::regclass

There should be a relationship between a user and a driver, where the user has one driver.

In my user (Devise) model I have has_one :driver

and in my driver migration I have:

t.string :user_id
t.belongs_to :user

So in the driver table the user_id field should hold the

Any direction is appreciated.