#ruby on rails
24 postsCaching variants with ActiveStorage
ActiveStorage is new in Rails 5.2 and it provides an integrated way to handle file uploads. It can store files on a cloud provider of your…
Sometimes it makes sense that you'll want to generate links back to your app from components of your app that don't have access to Rails…
Environment variables in assets with Heroku Pipelines
I’ve been using Heroku Pipelines for a bit on a new project which has been great at helping us take code from staging and push it to…
Ignoring Moment.js Locales with Webpacker
There’s a slight pain point when loading Moment.js through Webpack in that it pulls in every single locale available, regardless of whether…
Configuring Webpack externals with Webpacker
Webpack provides a feature known as externals which allows you to instruct it not to bundle any assets that you will provide externally at…
ActiveStorage variants & previews on Heroku
This solution does not work as expected - please see the comments for some more information regarding first-party support being added by…
Dynamic query order scopes in Rails
One of my favourite query scopes in Laravel is which will order the query by the latest models based on the column. In addition you can…
Absolute URL for an ActiveStorage attachment
Not sure why, but I couldn’t get to give me an absolute URL with an ActiveStorage attachment, even when playing with all the options…
Testing ActiveStorage Uploads in Rails 5.2
With ActiveStorage it’s pretty simple to test your controllers and check that file uploads are working the way you expect. Just configure…
Direct image uploads to S3 with ActiveStorage
I’ve been using the edge version of Rails on a new project so we can leverage ActiveStorage and the direct image uploading functionality it…
Import whole directory in Webpack(er)
Like an amateur I’ve been importing all my assets one-by-one when using Webpacker to get them all listed in the app manifest. It’s annoying…
Is webpack still compiling?
I’ve just run into this issue using Rails Webpacker on Heroku in production. Everything was worked fine locally but once it was deployed the…
Rails success? predicate deprecation
I’ve been running a new Rails project up on the branch while having a play with the new ActiveStorage module to see if it will be a good…
Replacing Rails Asset Pipeline with Webpacker
I'll admit that I'm still relatively new to Rails Webpacker, but on a new project I've decided to completely replace the Sprockets asset…
Incorrect coverage reporting on Heroku CI
I've recently started using Heroku CI to test my Heroku apps on Rails, but ran into a strange issue where Simplecov was reporting my code…
Processing ERB files with Rails Webpacker
When using Webpacker you may want to interpolate some values into your assets. For example, API keys are best to come from the deployment…
Rails UJS outside the asset pipeline/with modules
With Rails 5.1 the team replaced the great library with - the same feature set implemented without jQuery and rather using standalone…
Testing Rails redirect_back with RSpec
Rails has a handy redirect method called which replaces the old syntax. It's improved now because it gracefully handles the case where…
Request specs for Rack::Deflate
I've been tinkering about with after reading Thoughtbot's post on the topic. Works a charm, but I noticed a lot of the example specs for…
Rails Webpacker and Sass undefined variable error
I've recently started using Webpacker with Rails as an alternative to the asset pipeline. In addition to compiling my Javascript assets I've…
Using debugger-ruby_core_source fails to build native gem extension
I just ran into an issue where my Rails app would no longer bundle, and I couldn't get it running. It all looks good up until it gets to…
Using Rails UJS in Laravel 4 (or any other framework)
A while ago I posted a request to the Laravel framework to have an unobtrusive JavaScript library added, much like the one that is provided…
Installing Rails on Mac OS X
Found a cool new resource, Install Rails, a site made by the team from One Month Rails. If you're looking to get Rails installed on your…
Switching from CodeIgniter to Laravel
I've learnt a lot over the past year or so after spreading my wings from CodeIgniter. After toying with Ruby on Rails for a bit on a few…