Moving away from CanCanCan to Pundit

What is Pundit & CanCanCan? Pundit is a simple, platform-agnostic, plain-ol-Ruby authorization library. It provides a set of helpers to get authorization done simply no matter if its plain Ruby, Sinatra, or Rails. CanCanCan is a fork of the original CanCan Gem for Rails. CanCanCan, like Pundit, is an authorization…

shopify_app_whitelist Gem

I regularly use shopify_app. Its a great way to get an app, embedded or not, up and running with Rails. Sometimes I'll create apps with shopify_app which are to be used by only one store. These apps sometimes have a front-end component for the themes... proxy integration, or…

Journey to Sucker Punch

Background jobs are great. Mailing, data processing, image processing, database operations… you name it. If its a repetitive blocking process for the user and its not time-sensitive, then its probably suited to be moved to a job. delayed_job My go-to ActiveJob adapter for Rails has always been Delayed Job.…

Precompiling Assets In Your Rails Engine

This'll be a quick post to highlight an issue I had where I needed to precompile an asset file for my Rails engine that was not to be compiled with the other engine assets. Recently, I added TinyMCE-Rails to Guts instead of rolling it in on its own. This allows…

Polymorphic and Route Concerns... who is who?

The goal of this post is to outline some tips on easily figuring out the parent object for a polymorphic modal/route/controller. Let's start with the basics... Polymorphic For those unfamiliar to it, Polymorphic is an Active Record association type where a model can belong to other models. As…

ActiveRecord and Liquid Drops with Sinatra

Normally I use ERB when doing templates but there was a special use-case recently where I needed to allow the app user to modify a specific template. Liquid templates (what Jekyll and Shopify uses) was perfect for this situation because it has a simple syntax for anyone to pick up…

Quickly Get All Products in Your Shopify Store with Ruby

This is a simple snippet I've used over-and-over again this year to batch process products (modify tags, pricing, etc). It simply calculates the number of pages of products, pushes each page of products into a master array and returns them all. Should work well for others so I thought I…