The Captain's Log
The Captain's Log
Tales of achievement, bewilderment, and a surly relationship with a computer.
Tagged with: rails
A gotcha with Active Storage and Cloudflare
April 24, 2018 6:38pm
Rails 5.2 introduced Active Storage and it's pretty awesome. I'd used paperclip from the @thoughtbot folks for a long time, but file uploading is a requirement for just about any site these days so it might as well be part of the core. Now it is. ...
Categories in a Rails App
April 21, 2018 6:06pm
Categorizing things in a Rails app is a common need, but it's a non-trivial lift to get it all implemented. Database relationships need to be right. How in the world should you set up your forms? What's going on in my controllers? I'm going to do ...
Debugging in RubyMine with Rails 5.2
April 4, 2018 8:04pm
If you've upgraded to Rails 5.2 and are using RubyMine's debugger you might notice that breakpoints aren't working as they should. For me, they would only work in views, but controllers and models wouldn't stop anything. Turns out the problem is ...
Custom Validation in Rails
February 15, 2018 7:57pm
Here's a little trick I like to do when I'm addressing validations in my models. Let's say you have a standard Post model. It might look something like the following. If you're like me and prone to ideas popping into your head at inopportune time...
System Tests with RSpec, Rails, Capybara, and Devise
February 14, 2018 7:56pm
Since the release of RSpec 3.7 we've been able to take advantage of system tests which are new as of Rails 5.1. If you've been using RSpec for a while you're already likely familiar with feature tests using Capybara. For those new to these types o...
ActionMailer SMTP settings for SendGrid (Rails)
March 30, 2017 7:17pm
Okay, I got no Google hits for this. Here's a tip if you're using SendGrid in a Rails app for your transactional emails. A while back you needed to provide your SendGrid username and password (hopefully via environment variables), but now you can ...
Heroku defaults to Puma for Rails 5
May 2, 2016 12:07pm
It's now going to be easier than ever to kick off a new Rails project and deploy to Heroku. WEBrick is no longer the default server with Rails 5. If you don't provide a Procfile Heroku is going to help you out and set you up with Puma. Production ...
How to Create a Contact Form Using Rails and Mandrill
February 8, 2016 7:54pm
Let's build a simple contact form for your Rails driven website that uses Mandrill as the desired email server. Mandrill lets us offload the management of setting up and running an email server ourselves and, therefore, relieving ourselves of a ma...
Syntax Highlighting in Rails
February 1, 2016 8:04pm
Your Rails driven website has the need to display some code. It's not good enough to just get proper indentation, you'd like to have some decent syntax highlighting. Maybe something like following. There's a great ruby gem called Rouge that makes...
Editing a form using fields_for in Rails
January 18, 2016 7:59pm
Let's say you'd like to successfully create or update a nested form using fields_for. Our 'parent' will be a Post model and our 'child' will be a Tag model. It's not hard, but there's a bit of a gotcha that I found most other resources out there w...