The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
A Safer RuboCop
I wrote a short post on RuboCop’s improved safety in version 0.60.
HexaPDF 0.8.0 released - Box layout
The latest version of HexaPDF adds functionality to automatically place boxes on a page and flow text around arbitrary shapes. See https://hexapdf.gettalong.org/news/2018/hexapdf-0-8-0-box-layout.html for details
The short guide to learning how Classes work in Ruby
In this article, we’re going to explore the following topics:
How to use HMAC-SHA256 to connect to an API
I could not find much about using HMAC-SHA256 to connect to an API. So I figured it out and wrote a blog post about it. I used Ticketmatic as an example but this will work for other API’s too. https://www.runrails.com/programming/how-to-use-hmac-sha256-to-connect-to-a-rest-api-like-ticketmatic/
Domain Driven Rails Architecture
The following article describes DDD flavoured Rails application layout https://bpohoriletz.github.io/2018/10/26/domain-driven-rails-architecture-pattern.html
Launching Your Own Ruby Gem - Part 1: Build It
I’ll show you how to build a simple Ruby gem from scratch and publish it. By creating your own gem you can contribute back to the Ruby developers community https://buttercms.com/blog/launching-your-own-ruby-gem-build-it
New and shiny Passenger Docs
The new Passenger Docs just launched. We’ve updated, rerouted and regrouped our developer documentation for better discoverability and better flow: https://blog.phusion.nl/2018/10/25/passenger-docs/
How to Use Repository Pattern with Active Record
Let me guide you through the process of creating a repository pattern with Active Record in Rails, share some tips for improvement and lessons learned. https://www.monterail.com/blog/repository-pattern-active-record
Handling exceptions in Rails API applications
Handling exceptions in your API applications is quite an important thing, and if you want to keep things DRY, you should think how to do it in the proper way. https://driggl.com/blog/a/handling-exceptions-in-rails-applications [more inside]
Rails validations and multi-page forms
I was recently running a small training session where we were talking about the Rails validation helpers. These are one-liners in a Rails model that enable you to carry out common validations, for example…. [more inside]
Content Security Policy (Ruby on Rails)
Recently, we made changes to our codebase in regards to Content Security Policy (CSP). This article starts with a minuscule intro to CSP, then talks about why we decided to change our approach, what we changed, some unintended consequences and how we fixed things; it then ends with some observations and learnings. [more inside]
Configuration-driven state machines
Many projects need a state machine to control workflows, You can read all sorts of computer science articles on what a state machine is, but the essence is that a particular object can exist in a certain number of states only, and events will cause a transition from one state to another. [more inside]
Why the CSV library is broken (Part V) - Do You Want French Quotes with that Comma?
Hello, I’ve written a new (and fifth) episode on why the CSV standard library is broken (and how to fix it). Let’s have a look at quotes and leading and trailing spaces: Escaping the Stray Quote Error Hell - Do You Want Single, Double, or French Quotes With That Comma? Questions and comments welcome. Cheers. Prost. PS: If you want to see other (more) CSV formats / dialects pre-configured and supported “out-of-the-box” in the new csv reader, please tell.
`ActiveSupport::ArrayInquirer` and even more Rails
This week I learned that ActiveSupport::StringInquirier Rails class has a younger brother called ActiveSupport::ArrayInquirer. It adds some superpowers to Array objects. [more inside]
Talking about my first Rails pull request on The Ruby on Rails Podcast
I was absolutely honored when I was invited to speak and share my story a few weeks ago; from dipping my toes into very small bits of open source to getting a meaningful Rails PR accepted by DHH himself: https://schwad.github.io/ruby/rails/community/2018/10/16/talking-about-my-first-rails-core-pull-request-on-the-ruby-on-rails-podcast.html
Why software architecture really matters
Bottom line is, there isn’t such a thing as spending too much time on software architecture. A well-designed solution is worth thousands of hours. Why software architecture matters.
Hanami v1.3.0
Switch to RSpec, deprecations, minor enhancements, and bug fixes. New Guides website and new team member. From now on, our focus will be for 2.0. We’ll deeply integrate DRY & ROM. http://hanamirb.org/blog/2018/10/24/announcing-hanami-130.html
Webpacker can’t find application.js in public/packs/manifest.json error
Debugging silently failing compilation aka Webpacker can’t find application.js in public/packs/manifest.json.
csvreader v1.1.0 - adds records with fixed width fields (fwf) and no separator :-)
Hello, I’ve added the CSV with meta data (front matter) block in YAML (CSVY) format and the “classic” fortran-style fixed width fields (FWF) with no separator in the latest csvreader library / gem update. Use: Csv.fixed.parse( ..., width: [8,8,32,14] ), for example, for the new flavor or Csv.meta to get the (optional) meta data block in the CSV v1.0 “The Right Way” format / flavor. Happy data wrangling with ruby. Cheers. Prost. PS: If you want to see other CSV flavors / dialects / formats / variants included, please tell.
"Ruby on Rails is slow"
Too frequent a complaint, but I see why: Rails makes it easy to be lazy.
describe v0.1.0 - A small command line dictionary
https://rubygems.org/gems/describe and https://github.com/cybcafe/describe [more inside]
How to: Execute RSpec in parallel locally
Local, parallel spec execution, right here, right no (before upgrades to Rails 6) 🏎️💨Just watch out to not cook your notebook 🔥 This is where desktops shine :-) 👉 http://bit.ly/testing-sanity-p3-local