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.
Building a Ruby C Extension From Scratch
In this edition of Ruby Magic, we’ll show you how to use code written in C from Ruby. This can be used to optimize performance sensitive parts of your code or to create an interface between a C library and Ruby. Read all about it.
Is Rouge the best code highlighting solutions for ruby apps?
We needed to implement the code highlighting solution for our blogs, and after some research we decided to use Rouge. In this article I present the detailed guide how to do that. [more inside]
Working with ActiveRecord Callbacks
This article goes through some helpful tips when working with ActiveRecord callbacks. [more inside]
The Architecture No One Needs
Single-page apps are all the rage these days despite being an awful business decision 99% of the time. The Architecture No One Needs argues why SPAs are a poor investment and offers some alternative solutions.
Forms—Comparing Django to Rails
This article is a short study in web application design, comparing Rails to Django using a simple web form as an example.
Building auto login for fast Rails development with Sorcery
Learn how to build auto login with Sorcery to speed up your development.
Ruby Quiz is Back (Fortnightly)! Challenge #1 - Read Comma-Separated Values (CSV)
Hello,
The Ruby Quiz is now back fortnightly (once every two weeks). Challenge #1 - Read Comma-Separated Values (CSV) from the “Real World”.
Let’s use the test.csv file from Apache Commons CSV Reader. The challenge: Code a parse method that passes the RubyQuizTest :-). Start from scratch or, yes, use any library / gem you can find. To qualify for solving the code challenge / puzzle you must pass the test. Post your code snippets on the “official” Ruby Quiz Channel,
that is, the ruby-talk mailing list. Happy hacking and data wrangling with Ruby.
PS: Thanks to RubyFlow and Peter Cooper for blocking my account. Last post (really only an edit others get blocked). See you in the free world. All the best. Cheers. Prost. PPS: If that’s how you treat your friends - how do you treat your enemies :-)..
Introducing Enkrip
Enkrip is Ruby gem to make your Active Record model seamlessly encrypt and decrypt your desired attributes. Under the hood it uses ActiveSupport::MessageEncryptor for encryption and decryption. https://www.railsmine.net/2018/10/introducing-enkrip.html
Galaaz: Better R for Ruby integration
Using GraalVM, now it is possible to smoothly integrate R invocations into Ruby code: https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021
Why the CSV library is broken (Part VI) - Fast, Faster, Fasterer, Fastest
Hello, I’ve written a new (and sixth) episode on why the CSV standard library is broken (and how to fix it). Let’s have a look at fixes in alternative CSV libraries out there: Fixes in Alternative CSV Libraries or Evolve or Die or Fast, Faster, Fasterer, Fastest 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. PS: (Update) Added Part VII or What’s Your Type? Guess. Again. And Again. And Again. Guess What’s a Schema For?
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]