Skip to content

Instantly share code, notes, and snippets.

View iseitz's full-sized avatar
💭
www.linkedin.com/in/irina-karchebnaya-seitz

iseitz iseitz

💭
www.linkedin.com/in/irina-karchebnaya-seitz
View GitHub Profile
Since it is a second time that I spend 2 hours on the same problem I'll leave the solution here
In case where you run the bundle exec rake db:create for the first time and get the error:
$ "rake aborted!
$ NoMethodError: undefined method 'name' in 'campsite' factory"
The problem is the Deprecation of static attributes in factory_bot 4.11 and up.
In your Gemfile you need to downgrade manually the factory_bot_rails from the latest version to something between 4.8.2 and 4.11
For example it can be: gem 'factory_bot_rails', '~> 4.8.2'

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@iseitz
iseitz / regenerate_credentials.md
Created October 4, 2023 06:24 — forked from db0sch/regenerate_credentials.md
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc