Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database that was last run in development #19

Open
the-teacher opened this issue Feb 10, 2023 · 2 comments
Open

database that was last run in development #19

the-teacher opened this issue Feb 10, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@the-teacher
Copy link
Owner

rspec -f documentation

ActiveRecord::EnvironmentMismatchError: You are attempting to modify a database that was last run in `development` environment.
You are running in `test` environment. If you are sure you want to continue, first set the environment using:

        bin/rails db:environment:set RAILS_ENV=test


Tasks: TOP => db:test:load => db:test:purge => db:check_protected_environments
(See full trace by running task with --trace)

Screenshot 2023-02-10 at 21 58 13

@the-teacher the-teacher added the help wanted Extra attention is needed label Feb 10, 2023
@the-teacher the-teacher self-assigned this Feb 10, 2023
@ibr5500
Copy link

ibr5500 commented Mar 7, 2023

Hello @the-teacher if you are using windows run this command => rails db:environment:set RAILS_ENV=test, and if you are using a different OS you can run this command bin/rails db:environment:set RAILS_ENV=test

@ibr5500
Copy link

ibr5500 commented Mar 7, 2023

This problem only shows when you are testing, Ruby on Rails has different databases for development, testing, and production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants