NoMethodError: undefined method `with_deleted`

NoMethodError: undefined method `with_deleted`

I am trying to seed my database, but I am running into this error where its telling me with_deleted is an undefined method in my seeds.rb:

I am trying to seed my database, but I am running into this error where its telling me with_deleted is an undefined method in my seeds.rb:

User.with_deleted.each(&:really_destroy!)
User.create(
  email: '[email protected]',
  roles: [:admin],
  password: 'abc123',
  password_confirmation: 'abc123',
)

I believe it should have been defined from the paranoia gem. Can anyone suggest a workaround? I am working in Rails 5.1.

I tried both of these:

@user = User.create(
      email: '[email protected]',
      roles: [:admin],
      password: 'abc123',
      password_confirmation: 'abc123',
    )

and

User.create(
   email: '[email protected]',
   roles: [:admin],
   password: 'abc123',
   password_confirmation: 'abc123',
)

and it looked like it worked but when I did a User.last in rails c I still got nil

As far as including act_as_paranoid in my User.rb file, this is what I have:

# acts_as_paranoid
include AddressFields
include MeAssessmentScoring

Is this not enough? But ultimately, can I just get this working without having to involve the paranoiagem? So far, what I have tried above has not worked and when I try to create a user within rails c, I get:

ActiveRecord::RecordInvalid: Validation failed: First name can't be blank, Last name can't be blank

when I ran this: user = User.create!(email:'[email protected]', roles:'admin',password:'abc123', password_confirmation:'abc123')

ruby-on-rails

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Explain Ruby on rails MVC

Our Ruby on Rails Training will provide you to learn about Rails and web applications development with realty. Our Ruby on Rails Course also includes live sessions.

Pros & Cons you must know before using Ruby on Rails for your startup

Click here, free ruby on rails course videos for you. It shows you best way to complete Ruby certification. OnlineITGuru guides you towards easy Web script

Ruby on Rails Performance Tuning

Synchronises Assets between Rails and S3. Contribute to AssetSync/asset_sync development by creating an account on GitHub.