Tag: #rails

Rails Rate Limiting

Setting the Scene I noticed a lot of new “users” in one of my side projects, and immediately wondered what was going on, was this it, had I finally struck the startup gold?! Obviously I hadn’t, but nice to dream for a moment. On closer inspection, I noticed a barrage of posts to my sign-in form with interesting user names like these: "cmee7uvb'; waitfor delay '0:0:15' --", "0qjninbk' or 915=(select 915 from pg_sleep(15))--", "a77t30jc'; waitfor...

Solid Cable in Production with Kamal

Solid Cable in Production with Kamal Last week I wrote about Solid Cable and how amazingly easy it was to get up and running and add real time web socket magic to a Rails app. Rails 8 and the solid trifecta of Solid Cache, Solid Queue and Solid Cable, is a massive unlock to productivity, particularly evident when adding some of these historically pretty complicated capabilities and services: caching, job queues and web sockets respectively....

Super Solid Cable

Solid Cable Solid Cable is a new adapter for Action Cable - now the default in Rails 8 - that brings the magic of web sockets and real time updates to your Rails app. I’d never had chance to really use Action Cable before, but a colleague gave me a great suggestion to improve an internal tool I’ve been building, and that coincided with me having just reviewed some upcoming videos for the Rails Foundation...

Upgrading to Kamal 2

Kamal Back in February I wrote about an exciting new deployment tool called Kamal announced by DHH and 37signals. It really was a great gift and I quickly switched my personal projects over to Kamal and hosting on cheap VPS’s a Hetzner. The cool-aid was flowing and it tasted.. well, great! It was a bit fiddly to get working and had a few limitations - such as deploying multiple apps on one host was a...

Rails World 2024!

Rails World 2024 I’m running out of superlatives! This time last year I was euphorically writing about Rails World on returning from Amsterdam as it was simply spectacular. Fast forward to today as I sit in my hotel room about to head home from Rails World 2024 in Toronto, the feeling is only amplified tenfold. This extraordinary bringing together of the Rails community to celebrate, share and learn is something truly special. Highlights The announcements...

Action Text Video Support

Action Text Here’s a quick post just to document how I got video uploads working in Action Text, again mostly for “future me”, but hopefully helpful for others! Let me say, I love Action Text and Trix. For me at least its exactly what I need for simple text input that users can format and also upload images. I won’t go into the details of how to set it up as there are countless great...

Rails is 20

Happy Birthday Rails! A quick note and recognition what a huge milestone just came with the 20th anniversary of the launch of Ruby on Rails, which was originally announced on July 25th, 2004! A truly groundbreaking framework that is behind so many of the service we know and love over the last 20 years, it made me reflect on my journey and how grateful I am I found Rails. My Rails Story Back then I...

Rails 8 Minimum Browser Versions

Intro Just a short post this time but wanted to share a great new feature in Rails 8 that just solved a problem I didn’t know I had! Minimum Browser Version. Background As you likely know I’ve been working on a few side projects and got an email from a user who said one didn’t work in Safari! Now, I use Safari a lot too, but quickly realised they were on an old version and...

Default Browser Cache TTL Gotcha with Cloudflare

Asset Loading In my last article I shared how I upgraded a Rails app from Sprockets to Propshaft. This was a great simplification and improvement overall. But something wasn’t quite right. I kept noticing that there was a latency on the home page as some JavaScript was being loaded. Locally things were lightning fast, and it was starting to bug me what the issue could be. Opening up the web inspector I noticed that locally...

Au Revoir Sprockets, Hello Propshaft!

What is the Asset pipeline? In short, the asset pipeline in Rails helps us deliver JavaScript, CSS and images in the most performant and reliable way we can without being too onerous for developers to maintain. The “pipeline” in this context being the set of tools and processes applied to our asset source files during the build process to prepare them for optimized delivery. There have been many ways to do this over the years,...

Track Deployments in Appsignal with Kamal

Application Monitoring In a previous article I shared a quick tip on how to track deployments with honeybadger.io. Had some likes, retweets and nice comments on twitter (X) after sharing it, like this from Mikael Henriksson that had replies from both Joshua Wood the co-founder of Honeybadger.io, and Roy Tomeij the co-founder of Appsignal! Appsignal OK! So, eager to please - and also grateful for the stroopwafel cart at Rails World from fellow Foundation members...

Track Deployments in Honeybadger with Kamal

Application Monitoring Making sure you’re tracking errors, performance, uptime etc in your app is important even for the solo dev. In my career I’ve had experience with countless tools and platforms, but in recent years been a big fan of Sentry.io. I like the interface and it works great for Rails apps. This time though I wanted to try out something new, and had heard about Honeybadger.io as a great (and free) option for very...

Automated Database Backups with Kamal

Intro I wrote about my experience with Kamal last month and have since kicked off another project and successfully deployed to Hetzner with Kamal. These are small, personal projects of course, so very limited on terms of exercising scale, but equally they are things I’d typically be deploying to Heroku or Fly.io in the past, so deploying to my own servers is a real win! I built a small app to help managing pitches, scopes...

Sorting Lists with Ranked Model

Intro I tweeted earlier this week that one unexpected benefit of writing very detailed technical how-to articles on this blog is that I can refer back to my own posts and they’re EXACTLY what I need :D I kicked off a new personal project last weekend (more about that later), and having so much fun! The modern Rails stack is insanely good these days and a joy to work with. But wait… I need to...

Deploying with Kamal

Intro I’ve been hosting 1500cals.com on fly.io as I wrote about previously, and frankly, its really great. Particularly to get a Rails app up and hosted in minutes, harkening back to the old Heroku days when it was the defacto answer for almost instant free Rails hosting. However, last year when DHH introduced Kamal my interest was piqued! He described it as A simple yet battle-tested deployment tool extracted from our cloud exit, which features...

A First Look at Solid Queue and Mission Control Jobs

Background Jobs Background jobs are something most web developers need to start reaching for whenever there’s a long running task, or something outside the scope of a typical web request. One classic example, and the one we’ll use as an example today, is sending email. Of course Rails makes it easy to send emails with ActionMailer, and you can send an email asynchronously to a user in response to them clicking a ‘forgot email’ link...

Rails - The One Person Framework

History I’ll make no bones about it. I love Ruby and I love Rails! I was lucky to see DHH’s seminal Ruby on Rails demo video How to build a blog engine in 15 minutes in 2005 while I was working at a startup in San Francisco. At the time I was leading a team building J2ME, Brew and WAP mobile ringtone apps, with the backend all implemented with Java Servlets and JSP running on...

From Idea to App Store in 2 hours!

OK, I’ll admit it, “From Idea to App Store in 2 hours” was mainly to get you to click and a riff on my friend - and Turbo Native expert - Joe Masilotti’s excellent post “Idea to App Store in 7 days”, but hear me out. This is a true story about the power of Ruby on Rails and Turbo Native apps which was made even more apparent to me this weekend! Since my little...

1500cals in the iOS App Store!

1500cals is now in the iOS App Store! Quick Announcement: I’m thrilled to announce that just in time for those New Years resolutions, 1500cals passed certification with Apple first time, and is now available to all for FREE in the iOS App Store! Check it our and download it here: https://apps.apple.com/us/app/1500cals/id6470238113 I started building this just for myself to solve the annoyances I had with other calorie counting weight loss apps on my journey to...

1500cals iOS App Launched!

New iOS App Very excited to announce 1500cals for iOS is now available via Test Flight! I previously wrote about my journey to lose 50kg (110lbs) last year, the tools I used and then about the new app I was building to help plan meals and track exercise. I built this app for myself as I really wanted to use all the great features in Rails 7, Stimulus and Hotwire. The other key piece in...

New App Sneak Peek

What’s New? I’ve written before about my weight loss journey last year where I lost 50kg through mostly watching what I ate and starting to exercise. The main “trick” I uncovered is simply to plan meals ahead. It sounds boring, it sounds annoying, but really its such a tiny effort for such outsized and life changing rewards that it should be a no-brainer. The existing tools I found were more focused on tracking after eating...

Spectacular Rails World

Rails World 2023 I’m just home from the inaugural Rails World conference in Amsterdam, and the word that keeps popping in my head to describe it is simply “Spectacular”. In my role at Cookpad I’ve been fortunate to be the driving force behind our sponsorship and support of over 50 Ruby and Rails events around the world in the last ~10 years, and it’s something I’m immensely proud of, but what I just experienced was...

Get Started with Strada! A First Look on iOS

Tada! I mean, Strada! If you’ve been following along, you may know I’ve been getting quite interested in Turbo Native iOS for Rails. If you haven’t been following along.. why not! Anyhow, to recap, Turbo Native enables rapid development of hybrid apps, by wrapping a Rails 7 turbo-enabled webapp in a native iOS or Android shell. It really is fantastic and exposes so much more than just a simple web browser. The big news yesterday...

Active Storage CDN with Cloudfront and Subdomain in Rails

What we will be doing This post assumes you’re using Active Storage in a Rails app and want to switch to using a CDN. I’m writing it down because I spent all day figuring this out yesterday, and couldn’t find a definitive “how-to” article anywhere! In this article we will: Switch Active Storage to “Proxy Mode” Get an SSL cert for your sub-domain if you need one. Add a Cloudfront distribution in front of your...

Password-less SwiftUI Native Auth with Turbo iOS

Overview This post continues on from my last, where we implemented Password-less Authentication in Rails, which powers the backend to the app in this post. You can get the finished Source Code on GitHub or if you prefer, follow along below from scratch. What we’ll build In this article we’ll build a Turbo Native iOS app in Swift that wraps our Password-less Authentication Rails app from Part 1, enhancing it with native Swift UI authentication...

Password-less Auth with Rails

Overview I much prefer websites and apps that offer a way to sign in without needing a password purely from a usability standpoint, but there are some great benefits for developers too, for example: automatically confirm the user’s email address no need for sign in and sign up flows no need to implement “forgot password” Based on this, for a recent project I implemented password-less authentication for the web. Since this project benefits from HealthKit...

Learning to Fly... with Fly.io

Deploying a Rails app I’ve historically always reached for Heroku to deploy little apps and side projects when I wanted to push them out for others to see and use. When Heroku ended their “free” plan, several new platforms seemed to emerge or old alternatives gained renewed interest, such as render, hatchbox, fly, digital ocean and many others. In this post I’m going to focus on Fly.io which I’ve used a couple of times and...

Turbo Native Quick Start

Rails 7 and Hotwire As I mentioned in a previous post, Rails 7 is a real inflection point in terms of capabilities out of the box, the efficiencies and frankly a joyful development experience. You truly can get the speed and interactivity of a single-page web application without having to write any JavaScript. High-fidelity hybrid apps Turbo Native is a further part of the Hotwire ecosystem that enables development of hybrid apps, by wrapping a...

Dynamic Search with Hotwire

Hotwire is an incredible framework for making rich, responsive, and snappy client experiences with the minimum of complexity. It leans on Rails standard concepts of convention over configuration and omakase to deliver a simple developer experience without any trade off to performance or capabilities. In this example I’ll describe how I added a very simple dynamic search feature to a side project I’ve been working on, with a trivial amount of code and effort. The...

Rails 7 - Talk about a Revolution

Love, Love Me Do I loved Rails the instant I watched DHH’s “How to build a blog in 15 minutes with Rails” around 2005. To set the scene, at the time I was working at a ringtone startup in San Francisco (remember ringtones?!). The business was doing amazingly well - our first million dollar ringtone was 50 Cent P.I.M.P. in all its polyphonic glory - and we had a small dev team delivering a pretty...

Alexa Custom OAuth Account Linking with Rails

Custom skills with Amazon Echo devices provide a great way for users to interact with your product or service by voice. This is something particularly true at Cookpad where users are cooking, so their hands are often busy or messy with ingredients. Voice provides an excellent way to interact with a recipe while cooking. Conversely, searching by voice is really not a great experience. We’re all used to searching websites and perusing lists of results,...