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.
Manage Your Project's Environment Variables
How to use dotenv gem to manage your environment variables. [more inside]
Ask RubyFlow: Function as a service for Ruby?
Hi Folks, Do you use / know of any services like AWS Lambda that supports Ruby out of the box? [more inside]
football.json - New 2016/17 Season - Free open public domain football data in JSON
Hello, I’ve updated the /football.json repo / service that offers (auto-)generated match schedules (fixtures and results) and club listings for the major football leagues e.g. English Premier League, Deutsche Bundesliga, Primera División, Italian Seria A, etc. See the 2016-17 season folder for (static) JSON examples. No API key required ;-) All data public domain. Enjoy the beautiful game. Cheers. PS: Ruby works great for generating JSON; see the json.rb script for the code.
From monolithics to microservices.
This is not another post about application architectures but a software design instead. I bet you are a bit lost with the heading, keep reading, I will take you there. Read more
Building Rails API's With JSONAPI and JSONAPI-Resources
An article bringing together all the pieces I needed to understand how everything works. It finds the middle ground between specification and rote tutorial. [more inside]
How to Create a Polymorphic Whodunnit on PaperTrail
PaperTrail’s versioning and whodunnit to track auditing is fantastic. However, it falls apart if you have multiple user classes, such as Admin and User. Read on to keep your auditing trail clean and exact. [more inside]
How to Reduce Controller Bloat with Interactors
https://semaphoreci.com/community/tutorials/how-to-reduce-controller-bloat-with-interactors-in-ruby
Handling acronyms in rails
The ActiveSupport::Inflector handles a lot of the semantic rules in Rails, including acronyms. Continue reading…
Rails: Implementing a State Machine
State machines can come in handy for many situations. In this episode we show you how to implement a simple state machine using ActiveRecord Enum.
Get Your Data to Glass 180x Quicker: Rails, JSON and Clusterize.js
Displaying large, complicated reports was taking 6+ minutes to render in Chrome. I sped it up 180x using Rails to serve cached partials to Clusterizet
Tech Book Face Off: Design Patterns in Ruby Vs. Practical Object-Oriented Design
In this book review, I take a look at two older, but popular books on programming in Ruby. They are both well written, and I end up comparing them to numerous other books I’ve read on software design in addition to setting them against each other.
Ruby Podcast Episode 12
Learn about lambda calculus, advanced sql in rails, mutation testing, new rails 5 framework defaults and more in the Ruby Plus podcast episode 12
Implementing the Bit Array Data Structure in Ruby
In this article, I will explore how to implement the Bit Array data structure in Ruby, and compare its performance to the implementation in the bitarray gem, which uses a more efficient, but slightly more complex implementation. Continue reading…
Phoenix vs Rails: Views and helpers
Here’s an overview, case study and comparison to Phoenix of the V part of Rails MVC as experienced across the years. Read more on the Phoenix on Rails blog.
active_record_doctor 1.2.0 released
active_record_doctor helps you to identify database issues before they hit production. Version 1.2.0 can index foreign keys lacking an index and detect extraneous indexes (e.g. ones that can be replaced by a multi-column index) and take unique constraints into account.
How I Went Crazy With Solr and Sped up Rendering 1588x
Roll your own partial caching on Rails with Sunspot and Solr. Easy to do and stupid fast. Plus, fun to try out something a little different and watch it succeed spectacularly. [more inside]
How to use protected_attributes in Rails 5
Did you know that the only thing stopping you from using protected_attributes in Rails 5 is the gem dependencies and a small patch to ActiveRecord::Core. The rails repo of protected_attributes is not longer supported and issues and PR’s are denied. I have created the continuation of that gem protected_attributes_continued which supports Rails 5! https://github.com/westonganger/protected_attributes_continued
Recurring Events in Rails
In this article, I explore one one of the ways to model weekly recurring events in a Rails application. We will build a system where your users can set up a weekly recurring reminder (eg. “send status reports at 5pm on Fridays”). Continue reading…
API authentication using Devise and Doorkeeper (minimal setup)
Have you ever tried to setup Devise and Doorkeeper in the simplest possible way, without oauth applications etc? Here’s my new blog post about this!
Journey of a Trailblazer - Refactoring a real Rails app with Trailblazer
A blog post about refactoring a Rails application with the Trailblazer architecture. [more inside]
Rails 5 trims session storage by discarding some flash messages
Rails 5 trims down session storage by removing discarded flash messages before persisting into the session. [more inside]
The Pure Function As An Object Pattern
In this article, I want to demonstrate a nice way to write functional-style code in Ruby. It is a way to write non-trivial pure functions, without a bunch of weird non-idiomatic code.
What kind of tests should I write for my project?
Should I test my project? Should I write dozens of tests for each feature? What kind of tests should I focus on? Not all projects are created equal - testing is the same. Sometimes you need to test hard, sometimes you don’t. I’m sharing a few observations on testing from my 16 yrs experience as a software developer. Test fundamentalists do not open ;-)