To Bang or Not to Bang

Sometimes, things just stick in my brain. Months and months ago, I created a project that had this in my seed file:

User.create!(name: “Kate”, email: “kate@example.com”, password: “password”, birthday: “01/01/1980”, phone_number: “5125555555”, about_me: Faker::Lorem.paragraph)

(note: data is not real 😸)

This was for an app that’s live on the internet, as we speak, and I’m going to tell you why that’s kind of terrifying. It has everything to do with the !

! (or bang if you want to say it out loud) is the difference between a testing/sandbox environment and production. That little ! will cause your site crash instead of throwing an error message, which is great if you’re looking to diagnose a bug or are playing around with the site, but as a user, I’m not going to trust your site if it crashes when I’m trying to make an account.

It’s such a small detail, and it’s quite easy to forget if you put it in there while testing and push your code live without looking too closely. Since my app is being used by people other than me who probably don’t want to see the site crash if something goes wrong, I went ahead and took out all the !s in my code. But if a glorious site crash is more fun than a simple error message while you’re messing around for yourself, ! away!

That looks like a !. It's dangerous, give it to me!