Problems getting started


I’m new to Shrine and created a new Rails app for trying it out.
While playing along with the “Getting Started” doc I ran into problems.
Instead of images for a photo model I’m trying to add avatars to the user model.
After adding the include to the User model however, things stop working:

class User < ApplicationRecord
    include AvatarUploader::Attachment(:avatar)

2.7.1 :001 > User.first
Traceback (most recent call last):
         3: from (irb):1
         2: from app/models/user.rb:1:in `<main>'
         1: from app/models/user.rb:2:in `<class:User>'
NameError (uninitialized constant User (call 'User.connection' to establish a connection)::AvatarUploader)

AvatarUploader exists (like this:)

class AvatarUploader < Shrine

Am I overlooking something obvious? Any help would be appreciated.
I’m trying this on Rails 6.

Have you created your User model ?
And also created a record for the users so calling User.first does work ?

There is nothing wrong in what you have done so far …

The error looks like it’s happening because the rails console hasn’t yet connected to your database.

Simply type in:


and it should work!