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.
Do You Know How Hash Table Works? (Ruby Examples)
Hash table is a data structure that stores data in key-value pairs. It is also named as a dictionary or associative array and it is one of the most useful data structures in a programmer’s toolbox. [more inside]
JSON Serialization in Rails: A Complete Guide
Find out how to implement fast JSON serialization mechanisms in a Ruby on Rails application using the best available solutions.
React Hot Reload in Rails
If you read my first article about switching from Sprockets to Webpacker and the second one about Hot Module Reloading of CSS, you will love to read this, where I will introduce you, step by step, to have Hot Module Reload working on your React components. [more inside]
Chainable Queries for ElasticSearch
Using ElasticSearch with ruby has never been easier. search_flip provides a chainable and elegant DSL as easy as using ActiveRecord, even for nested aggregations. Version 1.1.0 ships with additional features, API methods and bug fixes. Great docs included.
Breaking Up a Monolith: Kong Case Study
Kong blew up their monolith. Wondering how they made the transition to microservices? Marco Palladino discusses the process in depth.
Quote opportunity: How did you land your first Rails development job?
Think back to your first job working with Rails – whether it was 8 months or 8 years ago. Do you have an interesting story to tell about your first Rails job? Any advice for a new developer beginning to work with Rails? I’d love to hear from you. Click below to send me your story and info to be quoted (with a link!) in an upcoming blog post on the Planet Argon blog. [more inside]
How to refactor long if-else condition
Little article about refactoring. Here is a link to medium
RuboCop Lineup
Restrict Rubocop to only changed lines on a Git branch: https://github.com/mysterysci/rubocop_lineup . This is not a new idea, but previous bits on the inter-webs seemed to be outdated and not fully functional. Hat tip to DirtyCop and the gist that DirtyCop was based on.
All World Cups (1930-2018) - $ sportdb new worldcup ++ Datafile worldcup.rb Updated
Hello, Due to popular demand and to make it easier for everybody I’ve updated the worldcup.rb datafile to build the complete world cup history, that is, all world cups included from Uruguay 1930 to Russia 2018. Try: $ sportdb new worldcup to build yourself an up-to-date (local) SQL database from scratch (zero). Enjoy the beautiful game. Cheers. Prost. PS: You can find the ready-to-use ActiveRecord models (tables) e.g. Team, Player, Goal, Player, League, Season, Group, Standing, etc. in the sportdb-models gem / library.
How to create perfect enum in 5 steps
A quick “How to” on managing attributes’ values using ActiveRecord’s Enum: http://naturaily.com/blog/post/ruby-on-rails---how-to-create-perfect-enum-in-5-steps
How Not to Lose the Database Logic in Rails Application
This article offers a way to handle tasks that require updating certain data when some other data is changed in Rails applications.
How to add I18n.locale as a part of caching key automatically
with https://github.com/igorkasyanchuk/cache_with_locale you can use fragment caching automatically with I18n.locale. No more code like “cache [I18n.locale, user]”. DRY your code.
Resgen: Resume Generator
Keep track of jobs you’ve applied to, automate resume & cover letter creation; generate PDFs from .odt templates on the fly while scraping the job post and tracking employer status. https://github.com/angela-d/resgen/ [more inside]
Clean HTML tables
I’ve just released version 1.0.0 of dining-table, a gem that allows you to write clean ruby classes to generate HTML tables, instead of messing with views. You can re-use the same classes to generate csv and xlsx output, too!
Rails API + JWT + VueJS SPA
This article describes how to build CSRF/XSS secure VueJS client for API-first Rails application.
footty - football.db command line tool / client for world cup (russia 2018) update
Hello, I’ve updated the little command line tool / client called footty that lets you query the online football.db HTTP JSON API services for today’s and tomorrow’s matches for the football world cup in russia 2018 - the world’s biggest show (3+ billion fans). What’s news? footty now includes the full time scores and goal getters e.g. POR 3-3 ESP: Ronaldo 4’ (pen.) Ronaldo 44’ Ronaldo 88’; Costa 24’ Costa 55’ Nacho 58’. Enjoy the beautiful game with ruby. Match day 3 (in JSON) thanks to /world-cup.json. Argentina vs Iceland upcoming. Kick off in seven hours.
How to track user events and visits in Rails using Ahoy gem!
In the realm of Rails Ahoy is a gem which we can use for tracking various events and visits as we want. It has saved a lot of time and effort for us! [more inside]
How to Speed Up Your Tests via :build_stubbed
Learn how to speed up your test suite using build_stubbed. This approach works well when you test models or services. [more inside]
Rails API CSRF protection for SPA
How to secure Rails API for SPA with CSRF protection? Is it needed for JWT ? Or just for session cookies? In this article we will look at the problems and solutions :) [more inside]
Organizing Ruby on Rails recurring tasks with Whenever
In this post I show you how you can use Whenever gem to manage recurring tasks in your Rails app, and how to integrate it with Rbenv and Capistrano [more inside]
Build-Measure-Learn after GDPR
In his talk at the Amsterdam Ruby Meetup, Niels van der Zanden explores how any small business trying to sell a thing on the internet can still get a feel for who their customers are, without overstepping the legal boundaries of the new data protection regulation: https://blog.phusion.nl/2018/06/14/build-measure-learn-after-gdpr/
Spree 3.5 and 3.6 with Rails 5.2, Ruby 2.5 and ActiveStorage support released!
Spree is a complete, modular & API-driven open source ecommerce solution for Ruby on Rails. [more inside]